forked from robotframework/robotframework
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlib2html.py
executable file
·54 lines (40 loc) · 1.03 KB
/
lib2html.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
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
#!/usr/bin/env python
"""Usage: lib2html.py [ library | all ]
Libraries:
BuiltIn (bu)
Collections (co)
DateTime (da)
Dialogs (di)
OperatingSystem (op)
Process (pr)
Screenshot (sc)
String (st)
Telnet (te)
XML (xm)
"""
from os.path import abspath, dirname, join
import sys
import re
ROOT = dirname(dirname(dirname(abspath(__file__))))
sys.path.insert(0, join(ROOT, 'src'))
from robot.libdoc import libdoc
LIBRARIES = {}
for line in __doc__.splitlines():
res = re.search('\s+(\w+) \((\w+)\)', line)
if res:
name, alias = res.groups()
LIBRARIES[name.lower()] = LIBRARIES[alias] = name
def create_libdoc(name):
libdoc(name, join(ROOT, 'doc', 'libraries', name+'.html'))
def create_all():
for name in sorted(set(LIBRARIES.values())):
create_libdoc(name)
if __name__ == '__main__':
try:
name = sys.argv[1].lower()
if name == 'all':
create_all()
else:
create_libdoc(LIBRARIES[name])
except (IndexError, KeyError):
print __doc__