Initial revision
[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 for i in open(f).read().splitlines():
14   # ignore empty lines
15
16   if i and i[0].isspace():
17     if not '*' in i:
18       print '      ' + i.strip()
19     else:
20       s = i.split('*', 1)[1].strip()
21       print '  <LI>' + s.replace('<', '&lt;').replace('>', '&gt;')
22   else:
23     if blah:
24       print '</UL>'
25     print '<H3>%s</H3>' % i.strip()
26     print '<UL>'
27     blah = 1
28
29 if blah:
30   print '</UL>'