diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-18 20:43:43 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-18 20:43:43 +0100 |
commit | 1af7e393bebd02007da5f6e082b065b3f140bc5c (patch) | |
tree | 82fe3befbe24ccdd8da8150f3efa42f1842b6c3c /doc | |
parent | d93bec61c3e8f5e047f12ae3ce6a68fbc7a37273 (diff) | |
parent | aac01fbaf882e7ea73f5e915e40eed3824344b29 (diff) |
Merge pull request #68831 from YuriSizov/docs-classref-better-split
Improve class reference split, list variant types separately
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/tools/make_rst.py | 28 |
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") |