Ticket #7010: wikimarkup.patch
File wikimarkup.patch, 1.3 KB (added by , 17 years ago) |
---|
-
django/contrib/markup/templatetags/markup.py
10 10 11 11 * ReStructuredText, which requires docutils from http://docutils.sf.net/ 12 12 13 * MediaWiki markup, which requires wikimarkup from http://code.google.com/p/wikimarkup/ 14 13 15 In each case, if the required library is not installed, the filter will 14 16 silently fail and return the un-marked-up text. 15 17 """ … … 83 85 return mark_safe(force_unicode(parts["fragment"])) 84 86 restructuredtext.is_safe = True 85 87 88 def wikimarkup(value): 89 try: 90 import wikimarkup 91 except ImportError: 92 if settings.DEBUG: 93 raise template.TemplateSyntaxError, ("Error in {% wikimarkup %} " 94 "filter: The wikimarkup " 95 "library isn't installed.") 96 return force_unicode(value) 97 else: 98 return mark_safe(force_unicode(wikimarkup.parse(smart_str(value)))) 99 wikimarkup.is_safe = True 100 86 101 register.filter(textile) 87 102 register.filter(markdown) 88 103 register.filter(restructuredtext) 104 register.filter(wikimarkup)