From 133164406a50d56633fa39fb553cbb838f70c529 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 15 Aug 2004 20:03:38 +0000 Subject: 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 --- writeHTML.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'writeHTML.py') 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: -- cgit v1.2.3-70-g09d2