diff --git a/station/lib/docgen.py b/station/lib/docgen.py index 287426d7..fa1aec45 100644 --- a/station/lib/docgen.py +++ b/station/lib/docgen.py @@ -26,13 +26,24 @@ def gen_docs(string_manager, metastations): ) for waypoint in [False, True]: + if metastation.categories is None: + subsections = {None: [x for x in metastation.doc_layouts if ("waypoint" not in x.notes) ^ waypoint]} + else: + subsections = {k: [] for k in metastation.categories} + for layout in metastation.doc_layouts: + if ("waypoint" not in layout.notes) ^ waypoint: + subsections[layout.category].append(layout) + + if all(len(v) == 0 for v in subsections.values()): + continue + with open( os.path.join(prefix, f"{metastation_label}_{'waypoints' if waypoint else 'building_blocks'}.md"), "w" ) as f: print( f"""--- layout: default -title: Building Blocks +title: {"Waypoints" if waypoint else "Building Blocks"} parent: {translation} grand_parent: "CNS Addon: Wuhu" nav_order: {2 if waypoint else 1} @@ -41,14 +52,6 @@ def gen_docs(string_manager, metastations): file=f, ) - if metastation.categories is None: - subsections = {None: [x for x in metastation.doc_layouts if ("waypoint" not in x.notes) ^ waypoint]} - else: - subsections = {k: [] for k in metastation.categories} - for layout in metastation.doc_layouts: - if ("waypoint" not in layout.notes) ^ waypoint: - subsections[layout.category].append(layout) - for sub in subsections: if sub is not None and len(subsections[sub]) > 0: cat_name = get_translation(