Ticket #11708: rst.patch
File rst.patch, 1.2 KB (added by , 15 years ago) |
---|
-
django/contrib/markup/templatetags/markup.py
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, arg='html4css1'): 80 """ 81 Optionally pass the name of a module containing a Writer class as an argument. 82 It will default to html4css1. See Docutils Hacker's Guide for documentation on Writers. 83 """ 80 84 try: 81 85 from docutils.core import publish_parts 82 86 except ImportError: … … 85 89 return force_unicode(value) 86 90 else: 87 91 docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {}) 88 parts = publish_parts(source=smart_str(value), writer_name= "html4css1", settings_overrides=docutils_settings)92 parts = publish_parts(source=smart_str(value), writer_name=arg, settings_overrides=docutils_settings) 89 93 return mark_safe(force_unicode(parts["fragment"])) 90 94 restructuredtext.is_safe = True 91 95