Ticket #11342: rst_config_writer.patch
File rst_config_writer.patch, 1.1 KB (added by , 15 years ago) |
---|
-
.py
old new 76 76 return mark_safe(force_unicode(markdown.markdown(smart_str(value)))) 77 77 markdown.is_safe = True 78 78 79 def restructuredtext(value ):79 def restructuredtext(value, writer=None): 80 80 try: 81 81 from docutils.core import publish_parts 82 82 except ImportError: … … 85 85 return force_unicode(value) 86 86 else: 87 87 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"])) 90 92 restructuredtext.is_safe = True 91 93 92 94 register.filter(textile)