feat: name each system once, from its own section

siterender.system_name reads the heading of the console section the id spells, then SYSTEM_NAMES, and raises for an id in neither. The emulator intro and the picker titles read it instead of the folder a system's files were voted onto.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 02:04:06 +02:00
1 parent 2a50bc21f7
commit 72e7507ff9
4 files changed
+695 -10

No files matched your search

+9 -9
View File
@@ -4656,12 +4656,9 @@ def _emulator_intro(emu_name: str, profile: dict) -> str:
The page opened on a twelve-row table: "Type", "Version", "Checked by".
DuckStation needs one PlayStation BIOS of any name, and the reader had
to infer it from the "Files found by" row."""
import siterender # noqa: PLC0415
names: list[str] = []
for sys_id in profile.get("systems") or []:
page = siterender._system_page_map.get(sys_id) or siterender._page_by_norm(sys_id)
label = page[1] if page else str(sys_id)
label = system_name(sys_id)
if label not in names:
names.append(label)
files = [f for f in profile.get("files") or [] if isinstance(f, dict)]
@@ -6675,6 +6672,7 @@ def _generate(args: argparse.Namespace) -> None:
_system_pages_from_data(manufacturers, coverages, db, profiles)
)
print(f" {len(_system_page_map)} system IDs mapped to pages")
set_console_sections(manufacturers, program_names(profiles))
print("Generating system pages...")
@@ -6864,11 +6862,10 @@ def _generate(args: argparse.Namespace) -> None:
json.dumps(sitestarlight.sidebar(nav, present), indent=1) + "\n")
write_if_changed(str(generated / "lastmod.json"),
json.dumps(dict(sorted(lastmod.items())), indent=1) + "\n")
mfr_names = {mfr.lower().replace(" ", "-"): mfr for mfr in manufacturers}
titles = {}
for sys_id, (slug, console) in _system_page_map.items():
mfr = mfr_names.get(slug, "")
titles[sys_id] = console if console.startswith(mfr) else f"{mfr} {console}"
system_ids = set(_system_page_map) | {
sys_id for cov in coverages.values() for sys_id in cov["config"].get("systems", {})
}
titles = {sys_id: system_name(sys_id) for sys_id in sorted(system_ids)}
sitestarlight.picker_data(_REPO_ROOT / "install", public / "data" / "picker", titles)
total_pages = len(present)
print(f"\nGenerated {total_pages} pages in {args.docs_dir}/")
@@ -6903,6 +6900,9 @@ from siterender import ( # noqa: E402,F401
_system_page_map,
_system_link,
set_system_page_map,
set_console_sections,
program_names,
system_name,
card_page,
console_href,
record_console_pages,