Skip to content

Commit 2099048

Browse files
committed
Fixed format_snippet to produce valid html (the previous filter order resulted in broken html entities and bad email addresses)
- Legacy-Id: 9553
1 parent d9535ce commit 2099048

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ietf/doc/templatetags/ietf_filters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import types
77
from email.utils import parseaddr
88

9+
import debug # pyflakes:ignore
10+
911
from ietf.doc.models import ConsensusDocEvent
1012
from django import template
1113
from django.conf import settings
@@ -458,7 +460,7 @@ def format_history_text(text, trunc_words=25):
458460

459461
@register.filter
460462
def format_snippet(text, trunc_words=25):
461-
full = mark_safe(keep_spacing(collapsebr(linebreaksbr(urlize(sanitize_html(text))))))
463+
full = keep_spacing(collapsebr(linebreaksbr(mark_safe(sanitize_html(urlize(text))))))
462464
snippet = truncatewords_html(full, trunc_words)
463465
if snippet != full:
464466
return mark_safe(u'<div class="snippet">%s<button class="btn btn-xs btn-default show-all"><span class="fa fa-caret-down"></span></button></div><div class="hidden full">%s</div>' % (snippet, full))

0 commit comments

Comments
 (0)