Skip to content

Commit

Permalink
(station) separate subdirectories for waypoints versus stations
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyangyi committed Sep 16, 2024
1 parent ce2bbaa commit d6b95b3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions station/lib/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def gen_docs(string_manager, metastations):
for i, metastation in enumerate(metastations):
metastation_label = metastation.class_label_plain
translation = get_translation(string_manager[f"STR_METASTATION_CLASS_{metastation_label}"], 0x7F)
os.makedirs(os.path.join(prefix, "img", metastation_label, "layouts"), exist_ok=True)
os.makedirs(os.path.join(prefix, "img", metastation_label, "tiles"), exist_ok=True)
for subdirectory in ["layouts", "stations", "waypoints"]:
os.makedirs(os.path.join(prefix, "img", metastation_label, subdirectory), exist_ok=True)

with open(os.path.join(prefix, f"{metastation_label}.md"), "w") as f:
print(
Expand All @@ -26,6 +26,7 @@ def gen_docs(string_manager, metastations):
)

for waypoint in [False, True]:
subdirectory = "waypoints" if waypoint else "stations"
if metastation.categories is None:
subsections = {
None: [x for x in metastation.doc_layouts if ("waypoint" not in x.doc_layout.notes) ^ waypoint]
Expand Down Expand Up @@ -70,11 +71,11 @@ def gen_docs(string_manager, metastations):
.to_pil_image()
)
idstr = f"{layout.id:04X}"
img.save(os.path.join(prefix, "img", f"{metastation_label}/tiles/{idstr}.png"))
img.save(os.path.join(prefix, "img", f"{metastation_label}/{subdirectory}/{idstr}.png"))
print(
f"""
<figure style="display:inline-block">
<img src="img/{metastation_label}/tiles/{idstr}.png" alt="{idstr}" width="64"/>
<img src="img/{metastation_label}/{subdirectory}/{idstr}.png" alt="{idstr}" width="64"/>
<figcaption style="text-align:center">{idstr}</figcaption>
</figure>
""",
Expand Down

0 comments on commit d6b95b3

Please sign in to comment.