blob: 9b3c8e20f15900c9b58c44de500cc593c54845d7 (
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
|
import sys
current_tag = None
current_doc = None
current_opt = False
print('<itemizedlist>')
with open(sys.argv[1]) as f:
for line in f:
line = line.strip();
if line.startswith('/* [XML'):
code = line.split()[1]
current_tag = line.split()[2]
current_opt = code == '[XML:opt]'
line = line[5+len(code)+len(current_tag):]
current_doc = ''
if current_tag is not None:
current_doc += line.replace('/* [XML] ', '').replace('*/', '').strip() + ' '
if line.find('*/') != -1 and current_tag is not None:
if current_opt:
optional = ' (optional)'
else:
optional = ''
print('<listitem><code><%s></code>%s — %s</listitem>' % (current_tag, optional, current_doc.strip()))
current_tag = None
print('</itemizedlist>')
|