Add mkdoc.sh script
This commit is contained in:
parent
9d3eec0475
commit
63454c7178
55
mkdoc.sh
Executable file
55
mkdoc.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
ALL_MODS="$(echo func_timeout/*.py | tr ' ' '\n' | sed -e 's|/|.|g' -e 's|.py$||g' -e 's|.__init__$||g' | tr '\n' ' ')"
|
||||
|
||||
pydoc -w ${ALL_MODS}
|
||||
mv *.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 = 'func_timeout.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 func_timeout.html index.html
|
||||
|
||||
popd >/dev/null 2>&1
|
||||
Loading…
Reference in New Issue
Block a user