#241 closed enhancement (fixed)
Add a django.contrib.markup app
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | Keywords: | textile filter template |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
We should add a django.contrib.markup
app, which would simply contain template tags to convert between markup languages such as Textile, Markdown, ReST, etc.
Here's a patch for a "textile" template filter:
Index: defaultfilters.py =================================================================== --- defaultfilters.py (revision 356) +++ defaultfilters.py (working copy) @@ -416,6 +416,23 @@ from pprint import pformat return pformat(value) +def textile(value, _): + "Generates XHTML from Textile markup developed by Dean Allen" + try: + # Try and import textile + from textile import textile + except ImportError: + # No textile? Just return text again + return value + + try: + value = textile(value) + except: + # Textile doesn't have a good system for rejecting bad input! + pass + + return value + # Syntax: template.register_filter(name of filter, callback, has_argument) template.register_filter('add', add, True) template.register_filter('addslashes', addslashes, False) @@ -452,6 +469,7 @@ template.register_filter('slugify', slugify, False) template.register_filter('stringformat', stringformat, True) template.register_filter('striptags', striptags, False) +template.register_filter('textile', textile, False) template.register_filter('time', time, True) template.register_filter('timesince', timesince, False) template.register_filter('title', title, False)
Change History (6)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
I support this! It might be good to get Markdown support in here as well. I'm a huge Textile fan, just to disclose my intentions ;)
comment:3 by , 19 years ago
For people who want to play with this type of stuff: Markdown for Python: http://www.freewisdom.org/projects/python-markdown/
Textile for python: http://dealmeida.net/en/Projects/PyTextile/
comment:4 by , 19 years ago
Description: | modified (diff) |
---|---|
Summary: | Addition of a Textile mark-up filter → Add a django.contrib.markup app |
comment:5 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Erm, sorry. It would have been better to submit the ticket and then attached the patch in a file.
I'll know for next time!