Ticket #11342: rst_config_writer.patch

File rst_config_writer.patch, 1.1 KB (added by Fredo, 15 years ago)
  • .py

    old new  
    7676            return mark_safe(force_unicode(markdown.markdown(smart_str(value))))
    7777markdown.is_safe = True
    7878
    79 def restructuredtext(value):
     79def restructuredtext(value, writer=None):
    8080    try:
    8181        from docutils.core import publish_parts
    8282    except ImportError:
     
    8585        return force_unicode(value)
    8686    else:
    8787        docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {})
    88         parts = publish_parts(source=smart_str(value), writer_name="html4css1", settings_overrides=docutils_settings)
    89         return mark_safe(force_unicode(parts["fragment"]))
     88        if writer is None:
     89            writer = getattr(settings, "RESTRUCTUREDTEXT_WRITER", "html4css1")
     90        parts = publish_parts(source=smart_str(value), writer_name=writer, settings_overrides=docutils_settings)
     91        return mark_safe(force_unicode(parts["body"]))
    9092restructuredtext.is_safe = True
    9193
    9294register.filter(textile)
Back to Top