Add a sanitize_html template filter.

- Legacy-Id: 2238
This commit is contained in:
Henrik Levkowetz 2010-05-06 13:39:27 +00:00
parent 604497a652
commit 51d735d5b6

View file

@ -117,6 +117,17 @@ def format_textarea(value):
Also calls keep_spacing."""
return keep_spacing(linebreaksbr(escape(value).replace('&lt;b&gt;','<b>').replace('&lt;/b&gt;','</b>').replace('&lt;br&gt;','<br>')))
@register.filter(name='sanitize_html')
def sanitize_html(value):
"""Sanitizes an HTML fragment.
This means both fixing broken html and restricting elements and
attributes to those deemed acceptable. See ietf/utils/html.py
for the details.
"""
from ietf.utils.html import sanitize_html
return sanitize_html(value)
# For use with ballot view
@register.filter(name='bracket')
def square_brackets(value):