From d61ed824cdb0c8a6086eea6a91737260d106d729 Mon Sep 17 00:00:00 2001 From: Ole Laursen Date: Wed, 4 Feb 2015 12:48:47 +0000 Subject: [PATCH] Summary: Replace old-style wordwrap custom tag with {% filter wordwrap %} - Legacy-Id: 8965 --- ietf/doc/templatetags/ietf_filters.py | 30 -------------------- ietf/templates/ipr/posted_document_email.txt | 6 ++-- 2 files changed, 3 insertions(+), 33 deletions(-) diff --git a/ietf/doc/templatetags/ietf_filters.py b/ietf/doc/templatetags/ietf_filters.py index ee4e2f0f8..855c70eeb 100644 --- a/ietf/doc/templatetags/ietf_filters.py +++ b/ietf/doc/templatetags/ietf_filters.py @@ -527,36 +527,6 @@ def consensus(doc): else: return "Unknown" -# The function and class below provides a tag version of the builtin wordwrap filter -# https://djangosnippets.org/snippets/134/ -@register.tag -def wordwrap(parser, token): - """ - This is a tag version of the Django builtin 'wordwrap' filter. This is useful - if you need to wrap a combination of fixed template text and template variables. - - Usage: - - {% wordwrap 80 %} - some really long text here, including template variable expansion, etc. - {% endwordwrap %} - """ - try: - tag_name, len = token.split_contents() - except ValueError: - raise template.TemplateSyntaxError, "The wordwrap tag requires exactly one argument: width." - nodelist = parser.parse(('endwordwrap',)) - parser.delete_first_token() - return WordWrapNode(nodelist, len) - -class WordWrapNode(template.Node): - def __init__(self, nodelist, len): - self.nodelist = nodelist - self.len = len - - def render(self, context): - return wrap(str(self.nodelist.render(context)), int(self.len)) - @register.filter def pos_to_label(text): """Return a valid Bootstrap3 label type for a ballot position.""" diff --git a/ietf/templates/ipr/posted_document_email.txt b/ietf/templates/ipr/posted_document_email.txt index 7b709a81c..ef691fb8c 100644 --- a/ietf/templates/ipr/posted_document_email.txt +++ b/ietf/templates/ipr/posted_document_email.txt @@ -6,10 +6,10 @@ Cc: {{ cc_email }} Dear {{ to_name }}: -{% wordwrap 80 %} +{% filter wordwrap:80 %} An IPR disclosure that pertains to your {{ doc_info }} was submitted to the IETF Secretariat on {{ ipr.submitted_date|date:"Y-m-d" }} and has been posted on the "IETF Page of Intellectual Property Rights Disclosures" (https://datatracker.ietf.org/ipr/{{ ipr.pk }}/). The title of the IPR disclosure is "{{ ipr.title }}" -{% endwordwrap %} +{% endfilter %} Thank you -IETF Secretariat \ No newline at end of file +IETF Secretariat