1 2 3 4 5 6 7 8 9 10 11 12 13 14 | from django import template
register = template.Library()
@register.filter
def render_markup(string, markup_lang=None):
from django.contrib.markup.templatetags import markup
if markup_lang:
markup_lang = markup_lang.lower()
try:
return getattr(markup, markup_lang)(string)
except AttributeError:
raise ValueError("Markup filter %r not found." % markup_lang)
return string
|
More like this
- i18n base model for translatable content by foxbunny 4 years, 10 months ago
- Function/Stored Procedure Manager by axiak 5 years, 11 months ago
- MarkupField by jpt 4 years, 2 months ago
- integrated jinja2 which could use generic view ,my djangojinja2.py by jasongreen 3 years, 4 months ago
- MarkupTextField by myles 4 years, 6 months ago
Comments