mirror of https://github.com/django/django.git
Fixed #6387 -- Updated markdown filter to handle markdown-1.7 as well as
earlier versions. Patch from cogg, jedie and Dmitri Fedortchenko. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7423 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ea87c0df5c
commit
8453a1750f
|
@ -65,7 +65,13 @@ def markdown(value, arg=''):
|
|||
safe_mode = True
|
||||
else:
|
||||
safe_mode = False
|
||||
return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
|
||||
|
||||
# Unicode support only in markdown v1.7 or above. Version_info
|
||||
# exist only in markdown v1.6.2rc-2 or above.
|
||||
if getattr(markdown, "version_info", None) < (1,7):
|
||||
return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
|
||||
else:
|
||||
return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))
|
||||
else:
|
||||
return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
|
||||
markdown.is_safe = True
|
||||
|
|
Loading…
Reference in New Issue