From c07e917777582ff1e70e8b57345397ef977d684e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 17 May 2003 07:44:15 +0000 Subject: Work on HTML generation svn:r8 --- writeHTML.py | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'writeHTML.py') diff --git a/writeHTML.py b/writeHTML.py index 689014e..0d2d41a 100644 --- a/writeHTML.py +++ b/writeHTML.py @@ -1,6 +1,40 @@ #!/usr/bin/python -import BiBTeX +import BibTeX +import config +bib = BibTeX.parseFile("anonbib.bib") +f = open("_template_.html") +template = f.read() +f.close() + +f = open("z.html", 'w') + +template_s, template_e = template.split("%(entries)s") + +print >>f, template_s + +entries = BibTeX.splitEntriesBy(bib.entries, "www_section") +sections = entries.keys() +sections.sort() +if entries.has_key(None): + for ent in entries[None]: + ent['www_section'] = "Miscellaneous" + + entries["Miscellaneous"] = entries[None] + del entries[None] + sections.append("Miscellaneous") + sections = filter(None, sections) + +for s in sections: + #XXX print '

'; + print >>f, '

%s

'%s + print >>f, "
    " + for e in entries[s]: + print >>f, e.to_html() + print >>f, "
" + + +print >>f, template_e -- cgit v1.2.3-70-g09d2