Fix for segfault in top_name stuff.
[monky] / changelog2html.py
1 #!/usr/bin/env python
2
3 import sys
4
5 if len(sys.argv) <= 1:
6   print >> sys.stderr, "Usage: ./changelog2html.py [changelog file]"
7   sys.exit(1)
8
9 f = sys.argv[1]
10
11 blah = 0
12
13 print '<html><head><meta http-equiv="content-type" content="text/html;charset=utf-8" /></head><body>'
14
15 for i in open(f).read().splitlines():
16   # ignore empty lines
17
18   if i and i[0].isspace():
19     if not '*' in i:
20       print '      ' + i.strip()
21     else:
22       s = i.split('*', 1)[1].strip()
23       print '  <li>' + s.replace('<', '&lt;').replace('>', '&gt;')
24   else:
25     if blah:
26       print '</ul>'
27     print '<h3>%s</h3>' % i.strip()
28     print '<ul>'
29     blah = 1
30
31 if blah:
32   print '</ul>'
33
34 print '</html></body>'