Add a sanitize_html template filter.
- Legacy-Id: 2238
This commit is contained in:
parent
604497a652
commit
51d735d5b6
|
@ -117,6 +117,17 @@ def format_textarea(value):
|
|||
Also calls keep_spacing."""
|
||||
return keep_spacing(linebreaksbr(escape(value).replace('<b>','<b>').replace('</b>','</b>').replace('<br>','<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):
|
||||
|
|
Loading…
Reference in a new issue