We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0481d97 commit ccfbde8Copy full SHA for ccfbde8
1 file changed
ietf/doc/templatetags/ietf_filters.py
@@ -428,7 +428,10 @@ def format_history_text(text, trunc_words=25):
428
429
@register.filter
430
def format_snippet(text, trunc_words=25):
431
- full = keep_spacing(collapsebr(linebreaksbr(mark_safe(sanitize_html(urlize(text))))))
+ # urlize if there aren't already links present
432
+ if not 'href=' in text:
433
+ text = urlize(text)
434
+ full = keep_spacing(collapsebr(linebreaksbr(mark_safe(sanitize_html(text)))))
435
snippet = truncatewords_html(full, trunc_words)
436
if snippet != full:
437
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