Ticket #5663: markdown_1.6b.3.diff
File markdown_1.6b.3.diff, 1.5 KB (added by , 17 years ago) |
---|
-
(a) - vs. (b) django/contrib/markup/templatetags/markup.py
a b 59 59 # markdown.version was first added in 1.6b. The only version of markdown 60 60 # to fully support extensions before 1.6b was the shortlived 1.6a. 61 61 if hasattr(markdown, 'version'): 62 62 extensions = [e for e in arg.split(",") if e] 63 63 if len(extensions) > 0 and extensions[0] == "safe": 64 64 extensions = extensions[1:] 65 65 safe_mode = True 66 66 else: 67 67 safe_mode = False 68 68 69 # Unicode support only in markdown v1.7 or above. Version_info 70 # exist only in markdown v1.6.2rc-2 or above. 71 if getattr(markdown, "version_info", None) < (1,7): 72 return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode))) 73 else: 74 return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode)) 69 return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode)) 75 70 else: 76 71 return mark_safe(force_unicode(markdown.markdown(smart_str(value)))) 77 72 markdown.is_safe = True 78 73 79 74 def restructuredtext(value): 80 75 try: 81 76 from docutils.core import publish_parts 82 77 except ImportError: 83 78 if settings.DEBUG: 84 79 raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed."