-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_docs.py
64 lines (56 loc) · 1.82 KB
/
generate_docs.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
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
#
# Lara Maia <[email protected]> 2015 ~ 2023
#
# The stlib is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# The stlib is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
import shutil
from pathlib import Path
from pdoc import doc, render, extract
import stlib
stlib_modules = [
'webapi',
'community',
'internals',
'login',
'universe',
'client',
'plugins',
'steamworks',
'utils',
]
if __name__ == "__main__":
render.configure(
logo_link='https://lara.monster/stlib',
footer_text='[email protected]',
)
html_path = Path('html')
shutil.rmtree(html_path)
html_path.mkdir()
stlib.__all__ = stlib_modules
all_modules = {
module_name: doc.Module.from_name(module_name)
for module_name in extract.walk_specs(['stlib'])
}
for module in all_modules.values():
html = render.html_module(module, all_modules=all_modules)
file = html_path / f"{module.fullname.replace('.', '/')}.html"
file.parent.mkdir(exist_ok=True)
file.write_bytes(html.encode())
index = render.html_index(all_modules)
index_path = html_path / "index.html"
index_path.write_bytes(index.encode())
search = render.search_index(all_modules)
search_path = html_path / "search.js"
search_path.write_bytes(search.encode())