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

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

Same diff with 10 lines of context

  • (a) - vs. (b) django/contrib/markup/templatetags/markup.py

    a b  
    5959        # markdown.version was first added in 1.6b. The only version of markdown
    6060        # to fully support extensions before 1.6b was the shortlived 1.6a.
    6161        if hasattr(markdown, 'version'):
    6262            extensions = [e for e in arg.split(",") if e]
    6363            if len(extensions) > 0 and extensions[0] == "safe":
    6464                extensions = extensions[1:]
    6565                safe_mode = True
    6666            else:
    6767                safe_mode = False
    6868
    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))
    7570        else:
    7671            return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
    7772markdown.is_safe = True
    7873
    7974def restructuredtext(value):
    8075    try:
    8176        from docutils.core import publish_parts
    8277    except ImportError:
    8378        if settings.DEBUG:
    8479            raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed."
Back to Top