Added new template filter 'textify' which changes </b> and </i> tags to '*' and '/' instead

- Legacy-Id: 4638
This commit is contained in:
Henrik Levkowetz 2012-07-27 21:22:43 +00:00
parent aa65e63dff
commit af2392084a

View file

@ -466,6 +466,13 @@ def user_roles_json(user):
roles[g.name] = True
return mark_safe(simplejson.dumps(roles))
@register.filter
def textify(text):
text = re.sub("</?b>", "*", text)
text = re.sub("</?i>", "/", text)
# There are probably additional conversions we should apply here
return text
def _test():
import doctest
doctest.testmod()