|
4 | 4 | from django import template |
5 | 5 | from django.conf import settings |
6 | 6 | from django.utils.html import escape, fix_ampersands |
7 | | -from django.template.defaultfilters import linebreaksbr, wordwrap, stringfilter, urlize, truncatewords_html |
| 7 | +from django.utils.text import truncate_html_words |
| 8 | +from django.template.defaultfilters import linebreaksbr, wordwrap, stringfilter, urlize |
8 | 9 | from django.template import resolve_variable |
9 | 10 | from django.utils.safestring import mark_safe, SafeData |
10 | 11 | from django.utils import simplejson |
@@ -460,9 +461,14 @@ def ad_area(user): |
460 | 461 | @register.filter |
461 | 462 | def format_history_text(text): |
462 | 463 | """Run history text through some cleaning and add ellipsis if it's too long.""" |
463 | | - full = mark_safe(sanitize_html(keep_spacing(linebreaksbr(urlize(mark_safe(text)))))) |
464 | | - snippet = truncatewords_html(format_textarea(text), 25) |
465 | | - if snippet[-3:] == "...": |
| 464 | + full = mark_safe(text) |
| 465 | + |
| 466 | + if text.startswith("This was part of a ballot set with:"): |
| 467 | + full = urlize_ietf_docs(full) |
| 468 | + |
| 469 | + full = mark_safe(sanitize_html(keep_spacing(linebreaksbr(urlize(full))))) |
| 470 | + snippet = truncate_html_words(full, 25) |
| 471 | + if snippet != full: |
466 | 472 | return mark_safe(u'<div class="snippet">%s<span class="showAll">[show all]</span></div><div style="display:none" class="full">%s</div>' % (snippet, full)) |
467 | 473 | return full |
468 | 474 |
|
|
0 commit comments