From 9ffe1e425af5cac210e0d4453f3615179be4cef4 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Tue, 27 Feb 2018 17:58:25 +0000 Subject: [PATCH] Reverted unintentional commit - Legacy-Id: 14709 --- ietf/settings.py | 3 ++ ietf/templates/doc/document_bibtex.bib | 10 +++--- ietf/utils/templatetags/textfilters.py | 45 ++------------------------ ietf/utils/text.py | 8 ----- 4 files changed, 10 insertions(+), 56 deletions(-) diff --git a/ietf/settings.py b/ietf/settings.py index 767ffb8ce..1105dfaec 100644 --- a/ietf/settings.py +++ b/ietf/settings.py @@ -613,6 +613,9 @@ CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:11211', + 'OPTIONS': { + 'MAX_ENTRIES': 10000, # 10,000 + }, }, 'htmlized': { 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', diff --git a/ietf/templates/doc/document_bibtex.bib b/ietf/templates/doc/document_bibtex.bib index 19d3bfebf..0a5895f99 100644 --- a/ietf/templates/doc/document_bibtex.bib +++ b/ietf/templates/doc/document_bibtex.bib @@ -1,7 +1,6 @@ {% spaceless %} -{% autoescape off %} + {% load ietf_filters %} -{% load textfilters %} {% if doc.get_state_slug == "rfc" %} {% if doc.stream|slugify == "legacy" %} @@ -25,14 +24,13 @@ publisher = {% templatetag openbrace %}Internet Engineering Task Force{% templatetag closebrace %}, note = {% templatetag openbrace %}Work in Progress{% templatetag closebrace %}, url = {% templatetag openbrace %}https://datatracker.ietf.org/doc/html/{{doc.name}}-{{doc.rev}}{% templatetag closebrace %},{% endif %} - author = {% templatetag openbrace %}{% for author in doc.documentauthor_set.all %}{{ author.person.name|texescape}}{% if not forloop.last %} and {% endif %}{% endfor %}{% templatetag closebrace %}, - title = {% templatetag openbrace %}{% templatetag openbrace %}{{doc.title|texescape}}{% templatetag closebrace %}{% templatetag closebrace %}, + author = {% templatetag openbrace %}{% for author in doc.documentauthor_set.all %}{{ author.person.name}}{% if not forloop.last %} and {% endif %}{% endfor %}{% templatetag closebrace %}, + title = {% templatetag openbrace %}{% templatetag openbrace %}{{doc.title}}{% templatetag closebrace %}{% templatetag closebrace %}, pagetotal = {{ doc.pages }}, year = {{ doc.pub_date.year }}, month = {{ doc.pub_date|date:"b" }},{% if not doc.rfc_number or doc.pub_date.day == 1 and doc.pub_date.month == 4 %} day = {{ doc.pub_date.day }},{% endif %} - abstract = {% templatetag openbrace %}{{ doc.abstract|clean_whitespace|texescape }}{% templatetag closebrace %}, + abstract = {% templatetag openbrace %}{{ doc.abstract|clean_whitespace }}{% templatetag closebrace %}, {% templatetag closebrace %} -{% endautoescape %} {% endspaceless %} diff --git a/ietf/utils/templatetags/textfilters.py b/ietf/utils/templatetags/textfilters.py index 0a065bc6e..1ee5e20c4 100644 --- a/ietf/utils/templatetags/textfilters.py +++ b/ietf/utils/templatetags/textfilters.py @@ -1,13 +1,11 @@ from __future__ import unicode_literals -from django import template +from django.template.library import Library from django.template.defaultfilters import stringfilter -import debug # pyflakes:ignore +from ietf.utils.text import xslugify as _xslugify -from ietf.utils.text import xslugify as _xslugify, texescape - -register = template.Library() +register = Library() @register.filter(is_safe=True) @stringfilter @@ -28,40 +26,3 @@ def format(format, values): tmp[f.name] = getattr(values, f.name) values = tmp return format.format(**values) - -# ---------------------------------------------------------------------- - -# from django.utils.safestring import mark_safe -# class TeXEscapeNode(template.Node): -# """TeX escaping, rather than html escaping. -# -# Mostly, this tag is _not_ the right thing to use in a template that produces TeX -# markup, as it will escape all the markup characters, which is not what you want. -# Use the '|texescape' filter instead on text fragments where escaping is needed -# """ -# def __init__(self, nodelist): -# self.nodelist = nodelist -# -# def render(self, context): -# saved_autoescape = context.autoescape -# context.autoescape = False -# text = self.nodelist.render(context) -# text = texescape(text) -# context.autoescape = saved_autoescape -# return mark_safe(text) -# -# @register.tag('texescape') -# def do_texescape(parser, token): -# args = token.contents.split() -# if len(args) != 1: -# raise TemplateSyntaxError("'texescape' tag takes no arguments.") -# nodelist = parser.parse(('endtexescape',)) -# parser.delete_first_token() -# return TeXEscapeNode(nodelist) - -@register.filter('texescape') -@stringfilter -def texescape_filter(value): - "A TeX escape filter" - return texescape(value) - diff --git a/ietf/utils/text.py b/ietf/utils/text.py index 9993fe0f4..60f08272e 100644 --- a/ietf/utils/text.py +++ b/ietf/utils/text.py @@ -11,8 +11,6 @@ from django.utils.safestring import mark_safe import debug # pyflakes:ignore -from texescape import init as texescape_init, tex_escape_map - @keep_lazy(six.text_type) def xslugify(value): """ @@ -176,9 +174,3 @@ def dict_to_text(d): for k, v in d.items(): t += "%s: %s\n" % (k, v) return t - -def texescape(s): - if not tex_escape_map: - texescape_init() - t = s.translate(tex_escape_map) - return t