Port away from django.utils.truncate_(html_)words which is now gone, use the template filter versions instead
- Legacy-Id: 6885
This commit is contained in:
parent
b3b7154890
commit
46247a2ba6
ietf
|
@ -6,9 +6,8 @@ from django.conf import settings
|
|||
from django.contrib.syndication.views import Feed, FeedDoesNotExist
|
||||
from django.utils.feedgenerator import Atom1Feed
|
||||
from django.core.urlresolvers import reverse as urlreverse
|
||||
from django.template.defaultfilters import truncatewords_html, date as datefilter, linebreaks
|
||||
from django.template.defaultfilters import truncatewords, truncatewords_html, date as datefilter, linebreaks
|
||||
from django.utils.html import strip_tags
|
||||
from django.utils.text import truncate_words
|
||||
|
||||
from ietf.doc.models import *
|
||||
from ietf.doc.utils import augment_events_with_revision
|
||||
|
@ -42,7 +41,7 @@ class DocumentChanges(Feed):
|
|||
return events
|
||||
|
||||
def item_title(self, item):
|
||||
return u"[%s] %s [rev. %s]" % (item.by, truncate_words(strip_tags(item.desc), 15), item.rev)
|
||||
return u"[%s] %s [rev. %s]" % (item.by, truncatewords(strip_tags(item.desc), 15), item.rev)
|
||||
|
||||
def item_description(self, item):
|
||||
return truncatewords_html(format_textarea(item.desc), 20)
|
||||
|
|
|
@ -9,8 +9,7 @@ from email.utils import parseaddr
|
|||
from django import template
|
||||
from django.conf import settings
|
||||
from django.utils.html import escape, fix_ampersands
|
||||
from django.utils.text import truncate_html_words
|
||||
from django.template.defaultfilters import linebreaksbr, wordwrap, stringfilter, urlize
|
||||
from django.template.defaultfilters import truncatewords_html, linebreaksbr, wordwrap, stringfilter, urlize
|
||||
from django.template import resolve_variable
|
||||
from django.utils.safestring import mark_safe, SafeData
|
||||
from django.utils.html import strip_tags
|
||||
|
@ -457,7 +456,7 @@ def format_history_text(text):
|
|||
full = urlize_ietf_docs(full)
|
||||
|
||||
full = mark_safe(keep_spacing(linebreaksbr(urlize(sanitize_html(full)))))
|
||||
snippet = truncate_html_words(full, 25)
|
||||
snippet = truncatewords_html(full, 25)
|
||||
if snippet != full:
|
||||
return mark_safe(u'<div class="snippet">%s<span class="show-all">[show all]</span></div><div style="display:none" class="full">%s</div>' % (snippet, full))
|
||||
return full
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.contrib.syndication.views import Feed, FeedDoesNotExist
|
|||
from django.utils.feedgenerator import Atom1Feed
|
||||
from django.core.urlresolvers import reverse as urlreverse
|
||||
from django.utils.html import strip_tags
|
||||
from django.utils.text import truncate_words
|
||||
from django.template.defaultfilters import truncatewords
|
||||
|
||||
from ietf.group.models import Group, GroupEvent
|
||||
from ietf.doc.models import DocEvent
|
||||
|
@ -50,7 +50,7 @@ class GroupChanges(Feed):
|
|||
return obj.time
|
||||
|
||||
def item_title(self, obj):
|
||||
title = u"%s - %s" % (truncate_words(strip_tags(obj.desc), 10), obj.by)
|
||||
title = u"%s - %s" % (truncatewords(strip_tags(obj.desc), 10), obj.by)
|
||||
if isinstance(obj, DocEvent):
|
||||
title = u"Chartering: %s" % title
|
||||
|
||||
|
|
Loading…
Reference in a new issue