Skip to content

Commit a5db4d0

Browse files
committed
Updated PLAN
- Legacy-Id: 14708
1 parent 9a456b8 commit a5db4d0

File tree

5 files changed

+56
-12
lines changed

5 files changed

+56
-12
lines changed

PLAN

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Updated: $Date$
77
Planned work in rough order
88
===========================
99

10-
* Upgrade Django to version 1.11
11-
1210
* Revisit the review tool, work through the accumulated tickets.
1311

1412
* Add sanitization of uploaded html documents.

ietf/settings.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,6 @@ def skip_unreadable_post(record):
613613
'default': {
614614
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
615615
'LOCATION': '127.0.0.1:11211',
616-
'OPTIONS': {
617-
'MAX_ENTRIES': 10000, # 10,000
618-
},
619616
},
620617
'htmlized': {
621618
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',

ietf/templates/doc/document_bibtex.bib

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{% spaceless %}
2-
2+
{% autoescape off %}
33
{% load ietf_filters %}
4+
{% load textfilters %}
45
56
{% if doc.get_state_slug == "rfc" %}
67
{% if doc.stream|slugify == "legacy" %}
@@ -24,13 +25,14 @@ @techreport{
2425
publisher = {% templatetag openbrace %}Internet Engineering Task Force{% templatetag closebrace %},
2526
note = {% templatetag openbrace %}Work in Progress{% templatetag closebrace %},
2627
url = {% templatetag openbrace %}https://datatracker.ietf.org/doc/html/{{doc.name}}-{{doc.rev}}{% templatetag closebrace %},{% endif %}
27-
author = {% templatetag openbrace %}{% for author in doc.documentauthor_set.all %}{{ author.person.name}}{% if not forloop.last %} and {% endif %}{% endfor %}{% templatetag closebrace %},
28-
title = {% templatetag openbrace %}{% templatetag openbrace %}{{doc.title}}{% templatetag closebrace %}{% templatetag closebrace %},
28+
author = {% templatetag openbrace %}{% for author in doc.documentauthor_set.all %}{{ author.person.name|texescape}}{% if not forloop.last %} and {% endif %}{% endfor %}{% templatetag closebrace %},
29+
title = {% templatetag openbrace %}{% templatetag openbrace %}{{doc.title|texescape}}{% templatetag closebrace %}{% templatetag closebrace %},
2930
pagetotal = {{ doc.pages }},
3031
year = {{ doc.pub_date.year }},
3132
month = {{ doc.pub_date|date:"b" }},{% if not doc.rfc_number or doc.pub_date.day == 1 and doc.pub_date.month == 4 %}
3233
day = {{ doc.pub_date.day }},{% endif %}
33-
abstract = {% templatetag openbrace %}{{ doc.abstract|clean_whitespace }}{% templatetag closebrace %},
34+
abstract = {% templatetag openbrace %}{{ doc.abstract|clean_whitespace|texescape }}{% templatetag closebrace %},
3435
{% templatetag closebrace %}
3536
37+
{% endautoescape %}
3638
{% endspaceless %}

ietf/utils/templatetags/textfilters.py

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
from __future__ import unicode_literals
22

3-
from django.template.library import Library
3+
from django import template
44
from django.template.defaultfilters import stringfilter
55

6-
from ietf.utils.text import xslugify as _xslugify
6+
import debug # pyflakes:ignore
77

8-
register = Library()
8+
from ietf.utils.text import xslugify as _xslugify, texescape
9+
10+
register = template.Library()
911

1012
@register.filter(is_safe=True)
1113
@stringfilter
@@ -26,3 +28,40 @@ def format(format, values):
2628
tmp[f.name] = getattr(values, f.name)
2729
values = tmp
2830
return format.format(**values)
31+
32+
# ----------------------------------------------------------------------
33+
34+
# from django.utils.safestring import mark_safe
35+
# class TeXEscapeNode(template.Node):
36+
# """TeX escaping, rather than html escaping.
37+
#
38+
# Mostly, this tag is _not_ the right thing to use in a template that produces TeX
39+
# markup, as it will escape all the markup characters, which is not what you want.
40+
# Use the '|texescape' filter instead on text fragments where escaping is needed
41+
# """
42+
# def __init__(self, nodelist):
43+
# self.nodelist = nodelist
44+
#
45+
# def render(self, context):
46+
# saved_autoescape = context.autoescape
47+
# context.autoescape = False
48+
# text = self.nodelist.render(context)
49+
# text = texescape(text)
50+
# context.autoescape = saved_autoescape
51+
# return mark_safe(text)
52+
#
53+
# @register.tag('texescape')
54+
# def do_texescape(parser, token):
55+
# args = token.contents.split()
56+
# if len(args) != 1:
57+
# raise TemplateSyntaxError("'texescape' tag takes no arguments.")
58+
# nodelist = parser.parse(('endtexescape',))
59+
# parser.delete_first_token()
60+
# return TeXEscapeNode(nodelist)
61+
62+
@register.filter('texescape')
63+
@stringfilter
64+
def texescape_filter(value):
65+
"A TeX escape filter"
66+
return texescape(value)
67+

ietf/utils/text.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
import debug # pyflakes:ignore
1313

14+
from texescape import init as texescape_init, tex_escape_map
15+
1416
@keep_lazy(six.text_type)
1517
def xslugify(value):
1618
"""
@@ -174,3 +176,9 @@ def dict_to_text(d):
174176
for k, v in d.items():
175177
t += "%s: %s\n" % (k, v)
176178
return t
179+
180+
def texescape(s):
181+
if not tex_escape_map:
182+
texescape_init()
183+
t = s.translate(tex_escape_map)
184+
return t

0 commit comments

Comments
 (0)