forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_docs.py
36 lines (26 loc) · 1.14 KB
/
build_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
# Copyright © SixtyFPS GmbH <[email protected]>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
import slint
import pdoc
import pathlib
import subprocess
doc = pdoc.doc.Module(slint)
model_cls = doc.get("Model")
for method in model_cls.inherited_members[("builtins", "PyModelBase")]:
method.is_inherited = False
if not method.name.startswith("_") and method.name != "init_self":
model_cls.own_members.append(method)
all_modules: dict[str, pdoc.doc.Module] = {"slint": doc}
output_directory = pathlib.Path("docs")
for module in all_modules.values():
out = pdoc.render.html_module(module, all_modules)
outfile = output_directory / f"{module.fullname.replace('.', '/')}.html"
outfile.parent.mkdir(parents=True, exist_ok=True)
outfile.write_bytes(out.encode())
index = pdoc.render.html_index(all_modules)
(output_directory / "index.html").write_bytes(index.encode())
search = pdoc.render.search_index(all_modules)
(output_directory / "search.js").write_bytes(search.encode())
subprocess.call(
"cargo about generate thirdparty.hbs -o docs/thirdparty.html", shell=True
)