-
Notifications
You must be signed in to change notification settings - Fork 5
/
mkdoc.sh
executable file
·56 lines (33 loc) · 981 Bytes
/
mkdoc.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
shopt -s nullglob
ALL_MODS="$(echo NamedAtomicLock/**.py | tr ' ' '\n' | sed -e 's|/|.|g' -e 's|.py$||g' -e 's|.__init__$||g' | tr '\n' ' ')"
pydoc -w ${ALL_MODS}
mv NamedAtomicLock*.html doc/
pushd doc >/dev/null 2>&1
rm -f index.html
for fname in `echo *.html`;
do
python <<EOT
import AdvancedHTMLParser
import sys
if __name__ == '__main__':
filename = "${fname}"
parser = AdvancedHTMLParser.AdvancedHTMLParser()
parser.parseFile(filename)
em = parser.filter(tagName='a', href='.')
if len(em) == 0:
sys.exit(0)
em = em[0]
em.href = 'NamedAtomicLock.html'
parentNode = em.parentNode
emIndex = parentNode.children.index(em)
i = len(parentNode.children) - 1
while i > emIndex:
parentNode.removeChild( parentNode.children[i] )
i -= 1
with open(filename, 'wt') as f:
f.write(parser.getHTML())
EOT
done
ln -s NamedAtomicLock.html index.html
popd >/dev/null 2>&1