Ticket #2910: markup.3.diff
File markup.3.diff, 1.2 KB (added by , 18 years ago) |
---|
-
contrib/markup/templatetags/markup.py
29 29 else: 30 30 return textile.textile(value, encoding=settings.DEFAULT_CHARSET, output=settings.DEFAULT_CHARSET) 31 31 32 def markdown(value ):32 def markdown(value, arg = ''): 33 33 try: 34 34 import markdown 35 35 except ImportError: … … 37 37 raise template.TemplateSyntaxError, "Error in {% markdown %} filter: The Python markdown library isn't installed." 38 38 return value 39 39 else: 40 return markdown.markdown(value) 40 extensions = arg.split(',') 41 if len(extensions) > 0 and extensions[0] == 'safe' : 42 extensions = extensions[1:] 43 safe_mode = True 44 else: 45 safe_mode = False 46 try: 47 return markdown.markdown(value, extensions, safe_mode = safe_mode) 48 except TypeError: 49 #older version of Markdown - run without extensions 50 return markdown.markdown(value) 41 51 42 52 def restructuredtext(value): 43 53 try: