aboutsummaryrefslogtreecommitdiffstats
path: root/BibTeX.py
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-06-08 14:18:41 -0400
committerNick Mathewson <nickm@torproject.org>2012-06-08 14:18:41 -0400
commit645aa02c049fbd0c02fd72ce330bed8d7684be64 (patch)
tree58eea7aae4953dc93ddd0925ed5026aab3eecd62 /BibTeX.py
parent6bf41292c1807437ec7472f7957227f6736109b0 (diff)
downloadanonbib-645aa02c049fbd0c02fd72ce330bed8d7684be64.tar.gz
Bang on the scripts until the W3C validator is happy
Apparently our output was trying to be XHTML 1.0 transitional. Now, it actually is.
Diffstat (limited to 'BibTeX.py')
-rw-r--r--BibTeX.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/BibTeX.py b/BibTeX.py
index bfe499e..110e5ff 100644
--- a/BibTeX.py
+++ b/BibTeX.py
@@ -34,9 +34,10 @@ WWW_FIELDS = [ 'www_section', 'www_important', 'www_remarks',
def url_untranslate(s):
"""Change a BibTeX key into a string suitable for use in a URL."""
- s = re.sub(r'([%<>, _])',
+ s = re.sub(r'([%<>`#, &_\';])',
lambda m: "_%02x"%ord(m.group(1)),
s)
+ s = s.replace("/",":")
return s
class ParseError(Exception):
@@ -328,6 +329,7 @@ class BibTeXEntry:
if np:
d.append("%%%%% "+("ERROR: Non-ASCII characters: '%r'\n"%np))
d.append(" ")
+ v = v.replace("&", "&amp;")
if invStrings.has_key(v):
s = "%s = %s,\n" %(f, invStrings[v])
else:
@@ -572,6 +574,7 @@ class BibTeXEntry:
url = self.get(key)
if not url: continue
url = unTeXescapeURL(url)
+ url = url.replace('&', '&amp;')
availability.append('<a href="%s">%s</a>' %(url,name))
if availability:
@@ -603,7 +606,7 @@ class BibTeXEntry:
res.append("</p>")
if self.get('www_remarks'):
- res.append("<p class='remarks'>%s</span>"%htmlize(
+ res.append("<p class='remarks'>%s</p>"%htmlize(
self['www_remarks']))
if imp or draft: