Opened 16 years ago
Closed 13 years ago
#9504 closed New feature (duplicate)
Extension for restructuredtext filter a django.contrib.markup
Description ¶
As suggested at 0 I browserd markup sorce code1 to see how does restructuredtext filter work. I founded that it returns only the fragment part instead on other contet. I suggest an argument fot the filter to be used in parts[arg].
The suggested implementation is, as follow (two small changes):
def restructuredtext(value, arg="fragment"): try: from docutils.core import publish_parts except ImportError: if settings.DEBUG: raise template.TemplateSyntaxError, "Error in {% restructuredtext %} filter: The Python docutils library isn't installed." return force_unicode(value) else: docutils_settings = getattr(settings, "RESTRUCTUREDTEXT_FILTER_SETTINGS", {}) parts = publish_parts(source=smart_str(value), writer_name="html4css1", settings_overrides=docutils_settings) return mark_safe(force_unicode(parts[arg])) restructuredtext.is_safe = True
[0] http://docs.djangoproject.com/en/dev/ref/contrib/#ref-contrib-markup
[1] http://code.djangoproject.com/browser/django/trunk/django/contrib/markup/templatetags/markup.py
Change History (8)
comment:1 by , 16 years ago
Component: | Uncategorized → Contrib apps |
---|
comment:2 by , 16 years ago
milestone: | post-1.0 |
---|
comment:3 by , 16 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:5 by , 14 years ago
Component: | Contrib apps → contrib.markup |
---|
comment:6 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
by , 13 years ago
Attachment: | 9504.patch added |
---|
comment:7 by , 13 years ago
Easy pickings: | unset |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
UI/UX: | unset |
Note:
See TracTickets
for help on using tickets.
Milestone post-1.0 deleted