aboutsummaryrefslogtreecommitdiffstats
path: root/writeHTML.py
blob: 0d2d41a00335491f91237322f8a317699521d707 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python

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