-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildhtml.py
35 lines (29 loc) · 860 Bytes
/
buildhtml.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
#!/usr/bin/env python
"""Build HMTL from reST files."""
from glob import glob
from os.path import splitext, join
from docutils.core import publish_file
print "Creating the documentation..."
for rst_file in glob(join('DBUtils', 'Docs', '*.txt')):
name = splitext(rst_file)[0]
lang = splitext(name)[1]
if lang.startswith('.'):
lang = lang[1:]
if lang == 'zh':
lang = 'zh_cn'
else:
lang = 'en'
html_file = name + '.html'
print name, lang
source = open(rst_file, 'r')
destination=open(html_file, 'w')
publish_file(writer_name='html',
source=source, destination=destination,
settings_overrides = dict(
stylesheet_path='Doc.css',
embed_stylesheet=False,
toc_backlinks=False,
language_code=lang
)
)
print "Done."