From 1673d2b2948143cd8f0eb85a2dfec192015052be Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 27 Jun 2007 18:26:42 +0000 Subject: r13508@kushana: nickm | 2007-06-27 14:26:35 -0400 More anonbib hacking to generate sane page headings, use CSS right on subpages, and link from the different bibliographies to one another. svn:r217 --- _template_.html | 7 ++++--- config.py | 2 +- writeHTML.py | 29 +++++++++++++++++++++++++---- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/_template_.html b/_template_.html index a3b1130..83abb85 100644 --- a/_template_.html +++ b/_template_.html @@ -15,14 +15,15 @@ %(title)s - - + + -

Anonymity bibliography

+

%(short_title)s

+

%(otherbibs)s

%(choices)s

diff --git a/config.py b/config.py index 5a7b585..6a25731 100644 --- a/config.py +++ b/config.py @@ -8,7 +8,7 @@ _KEYS = [ "ALL_TAGS", "DOWNLOAD_CONNECT_TIMEOUT","INITIAL_STRINGS", "MASTER_BIB", "NO_COLLAPSE_AUTHORS", "OMIT_ENTRIES", "OUTPUT_DIR", "TEMPLATE_FILE", "BIBTEX_TEMPLATE_FILE", - "REQUIRE_KEY", "TAG_TITLES", "TAG_DIRECTORIES" ] + "REQUIRE_KEY", "TAG_TITLES", "TAG_DIRECTORIES", "TAG_SHORT_TITLES" ] for _k in _KEYS: globals()[_k]=None diff --git a/writeHTML.py b/writeHTML.py index e6992d9..3184ef0 100755 --- a/writeHTML.py +++ b/writeHTML.py @@ -49,11 +49,14 @@ def writeBody(f, sections, section_urls, cache_path): print >>f, "" def writeHTML(f, sections, sectionType, fieldName, choices, - title, cache_url_path, section_urls={}): + tag, config, cache_url_path, section_urls={}): """sections: list of (sectionname, [list of BibTeXEntry])''' sectionType: str fieldName: str choices: list of (choice, url)""" + + title = config.TAG_TITLES[tag] + short_title = config.TAG_SHORT_TITLES[tag] # secStr = [] for s, _ in sections: @@ -63,6 +66,21 @@ def writeHTML(f, sections, sectionType, fieldName, choices, ((BibTeX.url_untranslate(s),hts))) secStr = "".join(secStr) + # + tagListStr = [] + st = config.TAG_SHORT_TITLES.keys() + st.sort() + root = "../"*pathLength(config.TAG_DIRECTORIES[tag]) + if root == "": root = "." + for t in st: + name = config.TAG_SHORT_TITLES[t] + if t == tag: + tagListStr.append(name) + else: + url = BibTeX.smartJoin(root, config.TAG_DIRECTORIES[t], "date.html") + tagListStr.append("%s"%(url, name)) + tagListStr = " | ".join(tagListStr) + # choiceStr = [] for choice, url in choices: @@ -78,7 +96,10 @@ def writeHTML(f, sections, sectionType, fieldName, choices, 'choices' : choiceStr, 'field': fieldName, 'sections' : secStr, + 'otherbibs' : tagListStr, 'title': title, + 'short_title': short_title, + "root" : root, } header, footer = getTemplate(config.TEMPLATE_FILE) @@ -122,7 +143,7 @@ def writePageSet(config, bib, tag): ("By date", "./date.html"), ("By author", "./author.html") ), - title=config.TAG_TITLES[tag], + tag=tag, config=config, cache_url_path=cache_url_path) f.close() @@ -153,7 +174,7 @@ def writePageSet(config, bib, tag): ("By date", None), ("By author", "./author.html") ), - title=config.TAG_TITLES[tag], + tag=tag, config=config, cache_url_path=cache_url_path) f.close() @@ -166,7 +187,7 @@ def writePageSet(config, bib, tag): ("By date", "./date.html"), ("By author", None), ), - title=config.TAG_TITLES[tag], + tag=tag, config=config, cache_url_path=cache_url_path, section_urls=url_map) f.close() -- cgit v1.2.3-70-g09d2