gnunetbib

Bibliography (BibTeX, based on AnonBib)
Log | Files | Refs | README | LICENSE

commit 3641288780ab579e502620250eb0eb779c838672
parent 977136688c230d7e1c9b5a9d23ba020a77d2e097
Author: Nick Mathewson <nickm@torproject.org>
Date:   Wed, 27 Jun 2007 18:26:42 +0000

 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

Diffstat:
M_template_.html | 7++++---
Manonbib.cfg | 9+++++++--
Mconfig.py | 2+-
MwriteHTML.py | 29+++++++++++++++++++++++++----
4 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/_template_.html b/_template_.html @@ -15,14 +15,15 @@ <!-- anon bib anonymity bibliography --> <title>%(title)s</title> -<link rel="stylesheet" type="text/css" href="./css/main.css" /> -<link rel="stylesheet" type="text/css" href="./css/pubs.css" /> +<link rel="stylesheet" type="text/css" href="%(root)s/css/main.css" /> +<link rel="stylesheet" type="text/css" href="%(root)s/css/pubs.css" /> </head> <body bgcolor="#ffffff" text="#000000" link="#bb0000" vlink="#990099" alink="#ff9900" > -<h1 align="center">Anonymity bibliography</h1> +<h1 align="center">%(short_title)s</h1> +<p align="center">%(otherbibs)s</p> <p align="center">%(choices)s</p> <!-- Table 1: contains the sidebar and the body. --> diff --git a/anonbib.cfg b/anonbib.cfg @@ -139,8 +139,13 @@ ALL_TAGS = ("selected", ) # Titles of page, by tag. TAG_TITLES = { "": "The Free Haven Anonymity Bibliography", - "selected": "Selected Papers in Anonymity at Free Haven" - } + "selected": "Free Haven's Selected Papers in Anonymity" + } + +# As TAG_TITLES, but shorter. +TAG_SHORT_TITLES = { "": "Anonymity Bibliography", + "selected": "Selected Papers in Anonymity", + } # Directories where tag pages get generated. TAG_DIRECTORIES = { '': "full", diff --git 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 @@ -49,11 +49,14 @@ def writeBody(f, sections, section_urls, cache_path): print >>f, "</ul></li>" 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: @@ -64,6 +67,21 @@ def writeHTML(f, sections, sectionType, fieldName, choices, 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("<a href='%s'>%s</a>"%(url, name)) + tagListStr = "&nbsp;|&nbsp;".join(tagListStr) + + # choiceStr = [] for choice, url in choices: if url: @@ -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()