aboutsummaryrefslogtreecommitdiffstats
path: root/writeHTML.py
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-08-15 20:03:38 +0000
committerNick Mathewson <nickm@torproject.org>2004-08-15 20:03:38 +0000
commit133164406a50d56633fa39fb553cbb838f70c529 (patch)
tree8f539ac5459da2d832f849743001d83ecccffcc6 /writeHTML.py
parentc1e3f892258e70c5308d9656661a46abcbf691ca (diff)
downloadanonbib-133164406a50d56633fa39fb553cbb838f70c529.tar.gz
Add basic unit tests; fix lastname,firstname name syntax; make configuration a separate file; make templates a configuration option; add separate cache jails to take advantage of apache http auth (last idea is from geoff)
svn:r109
Diffstat (limited to 'writeHTML.py')
-rw-r--r--writeHTML.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/writeHTML.py b/writeHTML.py
index 9f6a0fa..d25a0a0 100644
--- a/writeHTML.py
+++ b/writeHTML.py
@@ -14,7 +14,7 @@ import BibTeX
import config
def getTemplate(name):
- f = open(name+".html")
+ f = open(name)
template = f.read()
f.close()
template_s, template_e = template.split("%(entries)s")
@@ -70,11 +70,18 @@ def writeHTML(f, sections, sectionType, fieldName, choices, section_urls={}):
'sections' : secStr,
}
- header, footer = getTemplate("_template_")
+ header, footer = getTemplate(config.TEMPLATE_FILE)
print >>f, header%fields
writeBody(f, sections, section_urls)
print >>f, footer%fields
+if len(sys.argv) == 2:
+ print "Loading from %s"%sys.argv[1]
+else:
+ print >>sys.stderr, "Expected a single configuration file as an argument"
+ sys.exit(1)
+config.load(sys.argv[1])
+
bib = BibTeX.parseFile(config.MASTER_BIB)
##### Sorted views:
@@ -145,7 +152,7 @@ entries = bib.entries[:]
entries = [ (ent.key, ent) for ent in entries ]
entries.sort()
entries = [ ent[1] for ent in entries ]
-header,footer = getTemplate("_template_bibtex")
+header,footer = getTemplate(config.BIBTEX_TEMPLATE_FILE)
f = open(os.path.join(config.OUTPUT_DIR,"bibtex.html"), 'w')
print >>f, header % { 'command_line' : "" }
for ent in entries: