Code

Ticket #5663: markdown_1.6b.3.diff

File markdown_1.6b.3.diff, 1.5 KB (added by Daniel Pope <dan@…>, 6 years ago)

Same diff with 10 lines of context

Line 
1--- -   2008-04-28 09:15:09.598183351 +0100
2+++ django/contrib/markup/templatetags/markup.py        2008-04-27 13:56:25.000000000 +0100
3@@ -59,26 +59,21 @@
4         # markdown.version was first added in 1.6b. The only version of markdown
5         # to fully support extensions before 1.6b was the shortlived 1.6a.
6         if hasattr(markdown, 'version'):
7             extensions = [e for e in arg.split(",") if e]
8             if len(extensions) > 0 and extensions[0] == "safe":
9                 extensions = extensions[1:]
10                 safe_mode = True
11             else:
12                 safe_mode = False
13 
14-            # Unicode support only in markdown v1.7 or above. Version_info
15-            # exist only in markdown v1.6.2rc-2 or above.
16-            if getattr(markdown, "version_info", None) < (1,7):
17-                return mark_safe(force_unicode(markdown.markdown(smart_str(value), extensions, safe_mode=safe_mode)))
18-            else:
19-                return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))
20+            return mark_safe(markdown.markdown(force_unicode(value), extensions, safe_mode=safe_mode))
21         else:
22             return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
23 markdown.is_safe = True
24 
25 def restructuredtext(value):
26     try:
27         from docutils.core import publish_parts
28     except ImportError:
29         if settings.DEBUG:
30             raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed."