diff --git a/scripts/model/collection.py b/scripts/model/collection.py index 473954dd7..2fee667a1 100644 --- a/scripts/model/collection.py +++ b/scripts/model/collection.py @@ -188,10 +188,6 @@ def _profiles_in(emulators_dir: str, skip_aliases: bool) -> dict[str, dict]: return load_emulator_profiles(emulators_dir, skip_aliases=skip_aliases) -def _manufacturer_slug(manufacturer: str) -> str: - return manufacturer.lower().replace(" ", "-") - - # (manufacturer slug, folder, sha1) -> the (manufacturer slug, console) a # copy's card went to when the system pages file it outside its folder: # ScummVM's engine data under Other/ScummVM, neogeo.zip under Arcade. @@ -202,8 +198,8 @@ def record_card_move(manufacturer: str, folder: str, sha1: str, to_manufacturer: str, to_console: str) -> None: """Mark that the card of the copy under bios/// sits in the section (to_manufacturer, to_console).""" - _card_moves[(_manufacturer_slug(manufacturer), folder, str(sha1))] = ( - _manufacturer_slug(to_manufacturer), to_console) + _card_moves[(_slug(manufacturer), folder, str(sha1))] = ( + _slug(to_manufacturer), to_console) # System display names. A system is named by the heading of the console diff --git a/scripts/model/systemnames.py b/scripts/model/systemnames.py index a9ff77aca..e94a2c1fc 100644 --- a/scripts/model/systemnames.py +++ b/scripts/model/systemnames.py @@ -3,7 +3,7 @@ from __future__ import annotations from model import siteinputs -from model.collection import SECTION_LABELS, _PROGRAM_TOPS, _manufacturer_slug +from model.collection import SECTION_LABELS, _PROGRAM_TOPS, _slug # (manufacturer slug, console) -> the id of the console's heading. Two @@ -76,7 +76,7 @@ def set_console_sections( for mfr, consoles in by_maker.items(): used = {toc_slug(mfr)} for console in sorted(consoles): - _console_anchors[(_manufacturer_slug(mfr), console)] = _unique(toc_slug(console), used) + _console_anchors[(_slug(mfr), console)] = _unique(toc_slug(console), used) for mfr, console in pairs: spelled = console.lower().replace(" ", "-") slug = mfr.lower().replace(" ", "-") diff --git a/scripts/sitegen/render.py b/scripts/sitegen/render.py index 395e6e336..fd08b74b9 100644 --- a/scripts/sitegen/render.py +++ b/scripts/sitegen/render.py @@ -9,7 +9,7 @@ from collections.abc import Callable from model import siteinputs from sitegen import markup from core.paths import REPO_ROOT -from model.collection import _PROGRAM_TOPS, _card_moves, _manufacturer_slug +from model.collection import _PROGRAM_TOPS, _card_moves, _slug from model.systemnames import ( SYSTEM_PARENTS, _boards_built, @@ -189,7 +189,7 @@ def console_anchor(manufacturer: str, console: str) -> str: """The id of a console's heading on its manufacturer's page.""" from core.anchors import toc_slug - key = (_manufacturer_slug(manufacturer), console) + key = (_slug(manufacturer), console) return _console_anchors.get(key) or toc_slug(console) @@ -270,10 +270,10 @@ def _section_without_boards(sys_id: str) -> tuple[str, str] | None: reviewed parents give.""" own = _own_section(sys_id) if own is not None: - return _manufacturer_slug(own[0]), own[1] + return _slug(own[0]), own[1] parent = SYSTEM_PARENTS.get(sys_id) if parent is not None and parent in _section_pairs: - return _manufacturer_slug(parent[0]), parent[1] + return _slug(parent[0]), parent[1] try: name = system_name(sys_id) except KeyError: @@ -286,7 +286,7 @@ def _section_without_boards(sys_id: str) -> tuple[str, str] | None: mfr in _PROGRAM_TOPS and console.casefold() in _program_names ): return None - return _manufacturer_slug(mfr), console + return _slug(mfr), console def _system_link(sys_id: str, prefix: str = "") -> str: diff --git a/scripts/sitegen/startwith.py b/scripts/sitegen/startwith.py index 50ccacd4b..16c693a3a 100644 --- a/scripts/sitegen/startwith.py +++ b/scripts/sitegen/startwith.py @@ -302,9 +302,9 @@ def _start_groups( emulator's, its shaders and fonts. A file the emulator ships with is no file to fetch.""" from model.systemnames import _heading_name, system_name - from model.collection import _manufacturer_slug + from model.collection import _slug - here = (_manufacturer_slug(section[0]), section[1]) if section else None + here = (_slug(section[0]), section[1]) if section else None kept, candidates = _section_reads(files, consumers, here) groups: dict[str | None, _StartGroup] = {}