Ticket #9504: 9504.patch

File 9504.patch, 892 bytes (added by aaugustin, 4 years ago)
  • django/contrib/markup/templatetags/markup.py

     
    7474            return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
    7575
    7676@register.filter(is_safe=True)
    77 def restructuredtext(value):
     77def restructuredtext(value, arg="fragment"):
    7878    try:
    7979        from docutils.core import publish_parts
    8080    except ImportError:
     
    8484    else:
    8585        docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {})
    8686        parts = publish_parts(source=smart_str(value), writer_name="html4css1", settings_overrides=docutils_settings)
    87         return mark_safe(force_unicode(parts["fragment"]))
     87        return mark_safe(force_unicode(parts[arg]))
Back to Top