diff options
| author | Nick Mathewson <nickm@torproject.org> | 2003-05-20 18:56:27 +0000 |
|---|---|---|
| committer | Nick Mathewson <nickm@torproject.org> | 2003-05-20 18:56:27 +0000 |
| commit | 88b3048fb362fc83050303a76bf3d4236111f397 (patch) | |
| tree | 07b778aa1a867ffe75369cd70855deb9081aa250 | |
| parent | 409aac6f781e22b875e018e642b1b2c9a5a1bf31 (diff) | |
| download | anonbib-88b3048fb362fc83050303a76bf3d4236111f397.tar.gz | |
A better route to non-breaking section names.
svn:r15
| -rw-r--r-- | BibTeX.py | 7 | ||||
| -rw-r--r-- | writeHTML.py | 6 |
2 files changed, 8 insertions, 5 deletions
@@ -21,7 +21,6 @@ WWW_FIELDS = [ 'www_section', 'www_important', 'www_remarks', def url_untranslate(s): s = s.replace(" ", "+") - s = s.replace(" ", "+") s = re.sub(r'([%<>])', lambda m: "%%%02x"%ord(m.group(1)), s) @@ -107,12 +106,12 @@ def splitEntriesByAuthor(entries): for ent in entries: for a in ent.parsedAuthor: sortkey = txtize(" ".join(a.von+a.last+a.first+a.jr)) - secname = " ".join(a.last) + secname = " ".join(a.last) more = a.first+a.von if more: - secname += ", "+" ".join(more) + secname += ", "+" ".join(more) if a.jr: - secname += ", "+" ".join(a.jr) + secname += ", "+" ".join(a.jr) secname = htmlize(secname) url = author_url(secname) if url: diff --git a/writeHTML.py b/writeHTML.py index b39348e..c1d6935 100644 --- a/writeHTML.py +++ b/writeHTML.py @@ -19,6 +19,8 @@ def writeBody(f, sections, section_urls): section_urls: map from sectionname to external url''' for s, entries in sections: u = section_urls.get(s) + s = re.sub(r'\s+', ' ', s.strip()) + s = s.replace(" ", " ") if u: print >>f, ('<h3><a name="%s"><a href="%s">%s</a></a></h3>'%( (BibTeX.url_untranslate(s), u, s))) @@ -38,8 +40,10 @@ def writeHTML(f, sections, sectionType, fieldName, choices, section_urls={}): # secStr = [] for s, _ in sections: + hts = re.sub(r'\s+', ' ', s.strip()) + hts = s.replace(" ", " ") secStr.append("<p class='l2'><a href='#%s'>%s</a></p>\n"% - ((BibTeX.url_untranslate(s),s))) + ((BibTeX.url_untranslate(s),hts))) secStr = "".join(secStr) # |
