diff options
| author | Nick Mathewson <nickm@torproject.org> | 2003-05-17 07:44:15 +0000 |
|---|---|---|
| committer | Nick Mathewson <nickm@torproject.org> | 2003-05-17 07:44:15 +0000 |
| commit | c07e917777582ff1e70e8b57345397ef977d684e (patch) | |
| tree | b338cf645a0e3f9e3445e7d1364b093a8c677840 /writeHTML.py | |
| parent | c86cefb40e71e153a4decbc4aad9e2abb3518b57 (diff) | |
| download | anonbib-c07e917777582ff1e70e8b57345397ef977d684e.tar.gz | |
Work on HTML generation
svn:r8
Diffstat (limited to 'writeHTML.py')
| -rw-r--r-- | writeHTML.py | 36 |
1 files changed, 35 insertions, 1 deletions
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 '<h3><a name="', url_untranslate($section), '">'; + print >>f, '<h3>%s</h3>'%s + print >>f, "<ul class='expand'>" + for e in entries[s]: + print >>f, e.to_html() + print >>f, "</ul>" + + +print >>f, template_e |
