Skip to content

Commit

Permalink
(station) Fix docgen
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Sep 4, 2024
1 parent 65b1513 commit 7911a7b
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions station/lib/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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(
Expand Down

0 comments on commit 7911a7b

Please sign in to comment.