iwla

iwla Commit Details

Date:2014-12-19 11:35:00 (6 years 7 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:a37b661c1fdfd7a970b8b7f6861fa220657c4839
Parents: a35d462cb773a135cd09e6e9e12bcac1a041c7bc
Message:Add tools to automatically extract documentation

Changes:
Atools/extract_doc.py (full)
Atools/extract_docs.sh (full)

File differences

tools/extract_doc.py
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
#!/usr/bin/env python
import sys
filename = sys.argv[1]
if filename.endswith('__init__.py'):
sys.exit(0)
package_name = filename.replace('/', '.').replace('.py', '')
sys.stdout.write('**%s**' % (package_name))
sys.stdout.write('\n\n')
# sys.stdout.write('-' * len(package_name))
# sys.stdout.write('\n\n')
sys.stderr.write('\tExtract doc from %s\n' % (filename))
with open(filename) as infile:
copy = False
for line in infile:
if line.strip() in ['"""', "'''"]:
if not copy:
copy = True
else:
break
elif copy:
sys.stdout.write(line)
sys.stdout.write('\n\n')
tools/extract_docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
MODULES_TARGET="docs/modules.md"
MAIN_MD="docs/main.md"
TARGET_MD="docs/index.md"
rm -f "${MODULES_TARGET}"
echo "Generate doc from iwla.py"
python tools/extract_doc.py iwla.py > "${MODULES_TARGET}"
echo "Generate plugins documentation"
find plugins -name '*.py' -exec python tools/extract_doc.py \{\} \; >> "${MODULES_TARGET}"
echo "Generate ${TARGET_MD}"
cat "${MAIN_MD}" "${MODULES_TARGET}" > "${TARGET_MD}"

Archive Download the corresponding diff file

Branches

Tags