summaryrefslogtreecommitdiff
path: root/doc/tools
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2022-11-18 15:47:53 +0300
committerYuri Sizov <yuris@humnom.net>2022-11-18 15:47:53 +0300
commitaac01fbaf882e7ea73f5e915e40eed3824344b29 (patch)
treef6680413ec0ddb9f7fe54ee429741314b24d315f /doc/tools
parente8f9cd8ac5cf3e511e02d78a5497d204ca7e8308 (diff)
Improve class reference split, list variant types separately
Diffstat (limited to 'doc/tools')
-rwxr-xr-xdoc/tools/make_rst.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/doc/tools/make_rst.py b/doc/tools/make_rst.py
index 4f41baebf7..9fb60511ae 100755
--- a/doc/tools/make_rst.py
+++ b/doc/tools/make_rst.py
@@ -29,10 +29,12 @@ MARKUP_ALLOWED_SUBSEQUENT = " -.,:;!?\\/'\")]}>"
# write in this script (check `translate()` uses), and also hardcoded in
# `doc/translations/extract.py` to include them in the source POT file.
BASE_STRINGS = [
- "Objects",
+ "All classes",
+ "Globals",
"Nodes",
"Resources",
- "Globals",
+ "Other objects",
+ "Variant types",
"Description",
"Tutorials",
"Properties",
@@ -71,7 +73,13 @@ CLASS_GROUPS: Dict[str, str] = {
"global": "Globals",
"node": "Nodes",
"resource": "Resources",
- "class": "Objects",
+ "object": "Other objects",
+ "variant": "Variant types",
+}
+CLASS_GROUPS_BASE: Dict[str, str] = {
+ "node": "Node",
+ "resource": "Resource",
+ "object": "Object",
}
@@ -687,7 +695,7 @@ def get_git_branch() -> str:
def get_class_group(class_def: ClassDef, state: State) -> str:
- group_name = "class"
+ group_name = "variant"
class_name = class_def.name
if class_name.startswith("@"):
@@ -702,6 +710,9 @@ def get_class_group(class_def: ClassDef, state: State) -> str:
if inherits == "Resource":
group_name = "resource"
break
+ if inherits == "Object":
+ group_name = "object"
+ break
inode = state.classes[inherits].inherits
if inode:
@@ -1281,6 +1292,10 @@ def make_rst_index(grouped_classes: Dict[str, List[str]], dry_run: bool, output_
f.write(".. _doc_class_reference:\n\n")
+ main_title = translate("All classes")
+ f.write(f"{main_title}\n")
+ f.write(f"{'=' * len(main_title)}\n\n")
+
for group_name in CLASS_GROUPS:
if group_name in grouped_classes:
group_title = translate(CLASS_GROUPS[group_name])
@@ -1290,9 +1305,12 @@ def make_rst_index(grouped_classes: Dict[str, List[str]], dry_run: bool, output_
f.write(".. toctree::\n")
f.write(" :maxdepth: 1\n")
- f.write(" :name: toc-class-ref-globals\n")
+ f.write(f" :name: toc-class-ref-{group_name}s\n")
f.write("\n")
+ if group_name in CLASS_GROUPS_BASE:
+ f.write(f" class_{CLASS_GROUPS_BASE[group_name].lower()}\n")
+
for class_name in grouped_classes[group_name]:
f.write(f" class_{class_name.lower()}\n")