diff --git a/docs_assets/og/systems/3d-realms.png b/docs_assets/og/systems/3d-realms.png new file mode 100644 index 00000000..6c1aceab Binary files /dev/null and b/docs_assets/og/systems/3d-realms.png differ diff --git a/docs_assets/og/systems/3do-company.png b/docs_assets/og/systems/3do-company.png new file mode 100644 index 00000000..ecef1826 Binary files /dev/null and b/docs_assets/og/systems/3do-company.png differ diff --git a/docs_assets/og/systems/acorn.png b/docs_assets/og/systems/acorn.png new file mode 100644 index 00000000..afe851b1 Binary files /dev/null and b/docs_assets/og/systems/acorn.png differ diff --git a/docs_assets/og/systems/amstrad.png b/docs_assets/og/systems/amstrad.png new file mode 100644 index 00000000..cd840f30 Binary files /dev/null and b/docs_assets/og/systems/amstrad.png differ diff --git a/docs_assets/og/systems/apf.png b/docs_assets/og/systems/apf.png new file mode 100644 index 00000000..b9e5cda5 Binary files /dev/null and b/docs_assets/og/systems/apf.png differ diff --git a/docs_assets/og/systems/apogee.png b/docs_assets/og/systems/apogee.png new file mode 100644 index 00000000..5df63ae9 Binary files /dev/null and b/docs_assets/og/systems/apogee.png differ diff --git a/docs_assets/og/systems/apple.png b/docs_assets/og/systems/apple.png new file mode 100644 index 00000000..8d457c4e Binary files /dev/null and b/docs_assets/og/systems/apple.png differ diff --git a/docs_assets/og/systems/aquaplus.png b/docs_assets/og/systems/aquaplus.png new file mode 100644 index 00000000..eee80780 Binary files /dev/null and b/docs_assets/og/systems/aquaplus.png differ diff --git a/docs_assets/og/systems/arcade.png b/docs_assets/og/systems/arcade.png new file mode 100644 index 00000000..a7ce05be Binary files /dev/null and b/docs_assets/og/systems/arcade.png differ diff --git a/docs_assets/og/systems/atari.png b/docs_assets/og/systems/atari.png new file mode 100644 index 00000000..0b476599 Binary files /dev/null and b/docs_assets/og/systems/atari.png differ diff --git a/docs_assets/og/systems/bally.png b/docs_assets/og/systems/bally.png new file mode 100644 index 00000000..4919a825 Binary files /dev/null and b/docs_assets/og/systems/bally.png differ diff --git a/docs_assets/og/systems/bandai.png b/docs_assets/og/systems/bandai.png new file mode 100644 index 00000000..30afff09 Binary files /dev/null and b/docs_assets/og/systems/bandai.png differ diff --git a/docs_assets/og/systems/bbk.png b/docs_assets/og/systems/bbk.png new file mode 100644 index 00000000..89c1eb9f Binary files /dev/null and b/docs_assets/og/systems/bbk.png differ diff --git a/docs_assets/og/systems/bit-corporation.png b/docs_assets/og/systems/bit-corporation.png new file mode 100644 index 00000000..981aa730 Binary files /dev/null and b/docs_assets/og/systems/bit-corporation.png differ diff --git a/docs_assets/og/systems/blizzard.png b/docs_assets/og/systems/blizzard.png new file mode 100644 index 00000000..d377eb92 Binary files /dev/null and b/docs_assets/og/systems/blizzard.png differ diff --git a/docs_assets/og/systems/bungie.png b/docs_assets/og/systems/bungie.png new file mode 100644 index 00000000..f8365bd2 Binary files /dev/null and b/docs_assets/og/systems/bungie.png differ diff --git a/docs_assets/og/systems/camputers.png b/docs_assets/og/systems/camputers.png new file mode 100644 index 00000000..0a760df2 Binary files /dev/null and b/docs_assets/og/systems/camputers.png differ diff --git a/docs_assets/og/systems/casio.png b/docs_assets/og/systems/casio.png new file mode 100644 index 00000000..4c762962 Binary files /dev/null and b/docs_assets/og/systems/casio.png differ diff --git a/docs_assets/og/systems/coleco.png b/docs_assets/og/systems/coleco.png new file mode 100644 index 00000000..a02a4040 Binary files /dev/null and b/docs_assets/og/systems/coleco.png differ diff --git a/docs_assets/og/systems/commodore.png b/docs_assets/og/systems/commodore.png new file mode 100644 index 00000000..e915c648 Binary files /dev/null and b/docs_assets/og/systems/commodore.png differ diff --git a/docs_assets/og/systems/dinothawr.png b/docs_assets/og/systems/dinothawr.png new file mode 100644 index 00000000..cd585ee3 Binary files /dev/null and b/docs_assets/og/systems/dinothawr.png differ diff --git a/docs_assets/og/systems/dos.png b/docs_assets/og/systems/dos.png new file mode 100644 index 00000000..62b39c53 Binary files /dev/null and b/docs_assets/og/systems/dos.png differ diff --git a/docs_assets/og/systems/dragon.png b/docs_assets/og/systems/dragon.png new file mode 100644 index 00000000..d1bf13e1 Binary files /dev/null and b/docs_assets/og/systems/dragon.png differ diff --git a/docs_assets/og/systems/eaca.png b/docs_assets/og/systems/eaca.png new file mode 100644 index 00000000..c740fb1f Binary files /dev/null and b/docs_assets/og/systems/eaca.png differ diff --git a/docs_assets/og/systems/electronic-arts.png b/docs_assets/og/systems/electronic-arts.png new file mode 100644 index 00000000..52cfc6a4 Binary files /dev/null and b/docs_assets/og/systems/electronic-arts.png differ diff --git a/docs_assets/og/systems/elektronika.png b/docs_assets/og/systems/elektronika.png new file mode 100644 index 00000000..dad9570e Binary files /dev/null and b/docs_assets/og/systems/elektronika.png differ diff --git a/docs_assets/og/systems/enterprise.png b/docs_assets/og/systems/enterprise.png new file mode 100644 index 00000000..6cef95a2 Binary files /dev/null and b/docs_assets/og/systems/enterprise.png differ diff --git a/docs_assets/og/systems/entex.png b/docs_assets/og/systems/entex.png new file mode 100644 index 00000000..f915662b Binary files /dev/null and b/docs_assets/og/systems/entex.png differ diff --git a/docs_assets/og/systems/epic-megagames.png b/docs_assets/og/systems/epic-megagames.png new file mode 100644 index 00000000..2313133c Binary files /dev/null and b/docs_assets/og/systems/epic-megagames.png differ diff --git a/docs_assets/og/systems/epoch.png b/docs_assets/og/systems/epoch.png new file mode 100644 index 00000000..23afa089 Binary files /dev/null and b/docs_assets/og/systems/epoch.png differ diff --git a/docs_assets/og/systems/fairchild.png b/docs_assets/og/systems/fairchild.png new file mode 100644 index 00000000..f9f5c7ed Binary files /dev/null and b/docs_assets/og/systems/fairchild.png differ diff --git a/docs_assets/og/systems/fujitsu.png b/docs_assets/og/systems/fujitsu.png new file mode 100644 index 00000000..25b56c79 Binary files /dev/null and b/docs_assets/og/systems/fujitsu.png differ diff --git a/docs_assets/og/systems/funtech.png b/docs_assets/og/systems/funtech.png new file mode 100644 index 00000000..eacddf03 Binary files /dev/null and b/docs_assets/og/systems/funtech.png differ diff --git a/docs_assets/og/systems/galaksija.png b/docs_assets/og/systems/galaksija.png new file mode 100644 index 00000000..d8df0625 Binary files /dev/null and b/docs_assets/og/systems/galaksija.png differ diff --git a/docs_assets/og/systems/game-engines.png b/docs_assets/og/systems/game-engines.png new file mode 100644 index 00000000..0057af6f Binary files /dev/null and b/docs_assets/og/systems/game-engines.png differ diff --git a/docs_assets/og/systems/gamepark.png b/docs_assets/og/systems/gamepark.png new file mode 100644 index 00000000..4ac6d229 Binary files /dev/null and b/docs_assets/og/systems/gamepark.png differ diff --git a/docs_assets/og/systems/gce.png b/docs_assets/og/systems/gce.png new file mode 100644 index 00000000..0966094d Binary files /dev/null and b/docs_assets/og/systems/gce.png differ diff --git a/docs_assets/og/systems/gemei.png b/docs_assets/og/systems/gemei.png new file mode 100644 index 00000000..0bb90ffa Binary files /dev/null and b/docs_assets/og/systems/gemei.png differ diff --git a/docs_assets/og/systems/grundy.png b/docs_assets/og/systems/grundy.png new file mode 100644 index 00000000..274f9e7a Binary files /dev/null and b/docs_assets/og/systems/grundy.png differ diff --git a/docs_assets/og/systems/hartung.png b/docs_assets/og/systems/hartung.png new file mode 100644 index 00000000..dbd41c89 Binary files /dev/null and b/docs_assets/og/systems/hartung.png differ diff --git a/docs_assets/og/systems/ibm.png b/docs_assets/og/systems/ibm.png new file mode 100644 index 00000000..bb903188 Binary files /dev/null and b/docs_assets/og/systems/ibm.png differ diff --git a/docs_assets/og/systems/id-software.png b/docs_assets/og/systems/id-software.png new file mode 100644 index 00000000..9637c856 Binary files /dev/null and b/docs_assets/og/systems/id-software.png differ diff --git a/docs_assets/og/systems/infocom.png b/docs_assets/og/systems/infocom.png new file mode 100644 index 00000000..c396c370 Binary files /dev/null and b/docs_assets/og/systems/infocom.png differ diff --git a/docs_assets/og/systems/interact.png b/docs_assets/og/systems/interact.png new file mode 100644 index 00000000..0a15665b Binary files /dev/null and b/docs_assets/og/systems/interact.png differ diff --git a/docs_assets/og/systems/interplay.png b/docs_assets/og/systems/interplay.png new file mode 100644 index 00000000..3da0c569 Binary files /dev/null and b/docs_assets/og/systems/interplay.png differ diff --git a/docs_assets/og/systems/java.png b/docs_assets/og/systems/java.png new file mode 100644 index 00000000..e5311cf3 Binary files /dev/null and b/docs_assets/og/systems/java.png differ diff --git a/docs_assets/og/systems/lexaloffle.png b/docs_assets/og/systems/lexaloffle.png new file mode 100644 index 00000000..e3fddd5d Binary files /dev/null and b/docs_assets/og/systems/lexaloffle.png differ diff --git a/docs_assets/og/systems/magnavox.png b/docs_assets/og/systems/magnavox.png new file mode 100644 index 00000000..0f267f77 Binary files /dev/null and b/docs_assets/og/systems/magnavox.png differ diff --git a/docs_assets/og/systems/mattel.png b/docs_assets/og/systems/mattel.png new file mode 100644 index 00000000..81943eea Binary files /dev/null and b/docs_assets/og/systems/mattel.png differ diff --git a/docs_assets/og/systems/microsoft.png b/docs_assets/og/systems/microsoft.png new file mode 100644 index 00000000..165a80dc Binary files /dev/null and b/docs_assets/og/systems/microsoft.png differ diff --git a/docs_assets/og/systems/monolith.png b/docs_assets/og/systems/monolith.png new file mode 100644 index 00000000..511ad499 Binary files /dev/null and b/docs_assets/og/systems/monolith.png differ diff --git a/docs_assets/og/systems/nec.png b/docs_assets/og/systems/nec.png new file mode 100644 index 00000000..e1545ed1 Binary files /dev/null and b/docs_assets/og/systems/nec.png differ diff --git a/docs_assets/og/systems/nintendo.png b/docs_assets/og/systems/nintendo.png new file mode 100644 index 00000000..84f91f05 Binary files /dev/null and b/docs_assets/og/systems/nintendo.png differ diff --git a/docs_assets/og/systems/nokia.png b/docs_assets/og/systems/nokia.png new file mode 100644 index 00000000..5b01c37f Binary files /dev/null and b/docs_assets/og/systems/nokia.png differ diff --git a/docs_assets/og/systems/oric.png b/docs_assets/og/systems/oric.png new file mode 100644 index 00000000..2a0051a7 Binary files /dev/null and b/docs_assets/og/systems/oric.png differ diff --git a/docs_assets/og/systems/other.png b/docs_assets/og/systems/other.png new file mode 100644 index 00000000..b79cbff9 Binary files /dev/null and b/docs_assets/og/systems/other.png differ diff --git a/docs_assets/og/systems/palm.png b/docs_assets/og/systems/palm.png new file mode 100644 index 00000000..e599dce1 Binary files /dev/null and b/docs_assets/og/systems/palm.png differ diff --git a/docs_assets/og/systems/pc.png b/docs_assets/og/systems/pc.png new file mode 100644 index 00000000..0e9d3cdb Binary files /dev/null and b/docs_assets/og/systems/pc.png differ diff --git a/docs_assets/og/systems/philips.png b/docs_assets/og/systems/philips.png new file mode 100644 index 00000000..696c545c Binary files /dev/null and b/docs_assets/og/systems/philips.png differ diff --git a/docs_assets/og/systems/pioneer.png b/docs_assets/og/systems/pioneer.png new file mode 100644 index 00000000..51530fce Binary files /dev/null and b/docs_assets/og/systems/pioneer.png differ diff --git a/docs_assets/og/systems/qemu.png b/docs_assets/og/systems/qemu.png new file mode 100644 index 00000000..0b6a6421 Binary files /dev/null and b/docs_assets/og/systems/qemu.png differ diff --git a/docs_assets/og/systems/rca.png b/docs_assets/og/systems/rca.png new file mode 100644 index 00000000..53245404 Binary files /dev/null and b/docs_assets/og/systems/rca.png differ diff --git a/docs_assets/og/systems/real3d.png b/docs_assets/og/systems/real3d.png new file mode 100644 index 00000000..84d00566 Binary files /dev/null and b/docs_assets/og/systems/real3d.png differ diff --git a/docs_assets/og/systems/roland.png b/docs_assets/og/systems/roland.png new file mode 100644 index 00000000..874c5f8c Binary files /dev/null and b/docs_assets/og/systems/roland.png differ diff --git a/docs_assets/og/systems/rpg-maker.png b/docs_assets/og/systems/rpg-maker.png new file mode 100644 index 00000000..a2ea0855 Binary files /dev/null and b/docs_assets/og/systems/rpg-maker.png differ diff --git a/docs_assets/og/systems/scummvm.png b/docs_assets/og/systems/scummvm.png new file mode 100644 index 00000000..3da8bc4d Binary files /dev/null and b/docs_assets/og/systems/scummvm.png differ diff --git a/docs_assets/og/systems/sdl.png b/docs_assets/og/systems/sdl.png new file mode 100644 index 00000000..4dbae528 Binary files /dev/null and b/docs_assets/og/systems/sdl.png differ diff --git a/docs_assets/og/systems/sdlpal.png b/docs_assets/og/systems/sdlpal.png new file mode 100644 index 00000000..8adc3428 Binary files /dev/null and b/docs_assets/og/systems/sdlpal.png differ diff --git a/docs_assets/og/systems/sega.png b/docs_assets/og/systems/sega.png new file mode 100644 index 00000000..3a39f179 Binary files /dev/null and b/docs_assets/og/systems/sega.png differ diff --git a/docs_assets/og/systems/sharp.png b/docs_assets/og/systems/sharp.png new file mode 100644 index 00000000..c08efecf Binary files /dev/null and b/docs_assets/og/systems/sharp.png differ diff --git a/docs_assets/og/systems/sinclair.png b/docs_assets/og/systems/sinclair.png new file mode 100644 index 00000000..df0eb7d9 Binary files /dev/null and b/docs_assets/og/systems/sinclair.png differ diff --git a/docs_assets/og/systems/snk.png b/docs_assets/og/systems/snk.png new file mode 100644 index 00000000..5292a810 Binary files /dev/null and b/docs_assets/og/systems/snk.png differ diff --git a/docs_assets/og/systems/softdisk.png b/docs_assets/og/systems/softdisk.png new file mode 100644 index 00000000..51bc943f Binary files /dev/null and b/docs_assets/og/systems/softdisk.png differ diff --git a/docs_assets/og/systems/sony.png b/docs_assets/og/systems/sony.png new file mode 100644 index 00000000..feaa921f Binary files /dev/null and b/docs_assets/og/systems/sony.png differ diff --git a/docs_assets/og/systems/sord.png b/docs_assets/og/systems/sord.png new file mode 100644 index 00000000..b49f9df5 Binary files /dev/null and b/docs_assets/og/systems/sord.png differ diff --git a/docs_assets/og/systems/synertek.png b/docs_assets/og/systems/synertek.png new file mode 100644 index 00000000..fcca2471 Binary files /dev/null and b/docs_assets/og/systems/synertek.png differ diff --git a/docs_assets/og/systems/tandy.png b/docs_assets/og/systems/tandy.png new file mode 100644 index 00000000..c986751a Binary files /dev/null and b/docs_assets/og/systems/tandy.png differ diff --git a/docs_assets/og/systems/tangerine.png b/docs_assets/og/systems/tangerine.png new file mode 100644 index 00000000..9e888402 Binary files /dev/null and b/docs_assets/og/systems/tangerine.png differ diff --git a/docs_assets/og/systems/texas-instruments.png b/docs_assets/og/systems/texas-instruments.png new file mode 100644 index 00000000..daa259b0 Binary files /dev/null and b/docs_assets/og/systems/texas-instruments.png differ diff --git a/docs_assets/og/systems/thomson.png b/docs_assets/og/systems/thomson.png new file mode 100644 index 00000000..29b14187 Binary files /dev/null and b/docs_assets/og/systems/thomson.png differ diff --git a/docs_assets/og/systems/tiger.png b/docs_assets/og/systems/tiger.png new file mode 100644 index 00000000..62f70520 Binary files /dev/null and b/docs_assets/og/systems/tiger.png differ diff --git a/docs_assets/og/systems/timetop.png b/docs_assets/og/systems/timetop.png new file mode 100644 index 00000000..278a4c13 Binary files /dev/null and b/docs_assets/og/systems/timetop.png differ diff --git a/docs_assets/og/systems/tomy.png b/docs_assets/og/systems/tomy.png new file mode 100644 index 00000000..9ad202f6 Binary files /dev/null and b/docs_assets/og/systems/tomy.png differ diff --git a/docs_assets/og/systems/toys-for-bob.png b/docs_assets/og/systems/toys-for-bob.png new file mode 100644 index 00000000..fbaa9a38 Binary files /dev/null and b/docs_assets/og/systems/toys-for-bob.png differ diff --git a/docs_assets/og/systems/valve.png b/docs_assets/og/systems/valve.png new file mode 100644 index 00000000..ce603ac5 Binary files /dev/null and b/docs_assets/og/systems/valve.png differ diff --git a/docs_assets/og/systems/videobrain.png b/docs_assets/og/systems/videobrain.png new file mode 100644 index 00000000..8d1bbeb8 Binary files /dev/null and b/docs_assets/og/systems/videobrain.png differ diff --git a/docs_assets/og/systems/videoton.png b/docs_assets/og/systems/videoton.png new file mode 100644 index 00000000..766f1e8f Binary files /dev/null and b/docs_assets/og/systems/videoton.png differ diff --git a/docs_assets/og/systems/vircon.png b/docs_assets/og/systems/vircon.png new file mode 100644 index 00000000..47695434 Binary files /dev/null and b/docs_assets/og/systems/vircon.png differ diff --git a/docs_assets/og/systems/vtech.png b/docs_assets/og/systems/vtech.png new file mode 100644 index 00000000..472d5a9e Binary files /dev/null and b/docs_assets/og/systems/vtech.png differ diff --git a/docs_assets/og/systems/wenquxing.png b/docs_assets/og/systems/wenquxing.png new file mode 100644 index 00000000..d0956768 Binary files /dev/null and b/docs_assets/og/systems/wenquxing.png differ diff --git a/docs_assets/og/systems/zc.png b/docs_assets/og/systems/zc.png new file mode 100644 index 00000000..6bbcff5d Binary files /dev/null and b/docs_assets/og/systems/zc.png differ diff --git a/scripts/make_og_cards.py b/scripts/make_og_cards.py index c262c52c..0dd0409a 100644 --- a/scripts/make_og_cards.py +++ b/scripts/make_og_cards.py @@ -5,14 +5,16 @@ Each card is an SVG written by ``sitediagrams.og_card_svg`` from the registry, rasterised by a headless Chromium through Playwright, then committed under ``docs_assets/og/``. The site build copies the PNG files and never runs this script, so it adds nothing to the build's dependencies. -Run it again when a section's wording, the platform count or the list of -platforms changes. +Run it again when a section's wording, the platform count, the list of +platforms or the consoles of a manufacturer change. python scripts/make_og_cards.py python scripts/make_og_cards.py --only platforms + python scripts/make_og_cards.py --only systems A platform page shares a card with its own name (``og/platforms/.png``), -the other pages their section's. +a manufacturer's systems page one with the manufacturer's name and its +consoles (``og/systems/.png``), the other pages their section's. """ from __future__ import annotations @@ -25,27 +27,73 @@ ROOT = Path(__file__).resolve().parent.parent sys.path.insert(0, str(ROOT / "scripts")) from common import list_registered_platforms, load_platform_config # noqa: E402 -from sitediagrams import OG_SECTIONS, og_card_svg # noqa: E402 +from sitediagrams import OG_SECTIONS, og_card_svg, wrap # noqa: E402 OUT = ROOT / "docs_assets" / "og" LOGO = ROOT / ".github" / "assets" / "logo.png" PLATFORM_TAGLINE = "Which BIOS files it needs, and where each one goes" +# The tagline's box on the card: og_card_svg wraps it at this width and +# size, and three lines fit above the address. +TAGLINE_WIDTH, TAGLINE_SIZE, TAGLINE_LINES = 1000, 34, 3 -def platform_cards() -> dict[str, str]: +def platform_cards() -> dict[str, tuple[str, str]]: """Each platform page's card, by its path under og/, with its title.""" platforms = ROOT / "platforms" return { - f"platforms/{name}": load_platform_config(name, str(platforms))["platform"] + f"platforms/{name}": (load_platform_config(name, str(platforms))["platform"], + PLATFORM_TAGLINE) for name in list_registered_platforms(str(platforms), include_archived=True) } -def card_svg(key: str, logo: bytes, titles: dict[str, str]) -> str: +def consoles_tagline(consoles: list[str], lead: str = "BIOS files for") -> str: + """"BIOS files for PlayStation, PlayStation 2 and 5 more": as many + names as the card's three lines hold, the rest counted.""" + names = sorted(consoles, key=str.casefold) + for shown in range(len(names), 0, -1): + rest = len(names) - shown + listed = names[:shown] + if rest: + text = f"{lead} {', '.join(listed)} and {rest} more" + elif len(listed) > 1: + text = f"{lead} {', '.join(listed[:-1])} and {listed[-1]}" + else: + text = f"{lead} {listed[0]}" + if len(wrap(text, TAGLINE_WIDTH, TAGLINE_SIZE)) <= TAGLINE_LINES: + return text + return f"{lead} {len(names)} sections" + + +def system_cards() -> dict[str, tuple[str, str]]: + """Each manufacturer page's card under og/systems/, titled with the + manufacturer and listing its consoles. Read from the same grouping the + system pages are written from.""" + from common import GAME_DATA_TOPS, load_database + from generate_site import _group_by_manufacturer, _slug + + def lead(manufacturer: str) -> str: + # Other holds one folder per emulator, a game publisher's page its + # games' data: neither is a list of consoles. + if manufacturer in GAME_DATA_TOPS: + return "Game data for" + return "Files kept for the emulators" if manufacturer == "Other" else "BIOS files for" + + manufacturers = _group_by_manufacturer(load_database(str(ROOT / "database.json"))) + return { + f"systems/{_slug(manufacturer)}": ( + manufacturer, consoles_tagline(list(consoles), lead(manufacturer))) + for manufacturer, consoles in sorted(manufacturers.items()) + } + + +def card_svg(key: str, logo: bytes, titles: dict[str, tuple[str, str]]) -> str: if key in OG_SECTIONS: return og_card_svg(key, logo) - # A platform card is a section card with the platform's name for title. - OG_SECTIONS[key] = (titles[key], PLATFORM_TAGLINE) + # A page card is a section card with the page's own title and tagline. + # The tagline is a format string there: braces in a name stay text. + title, tagline = titles[key] + OG_SECTIONS[key] = (title, tagline.replace("{", "{{").replace("}", "}}")) try: return og_card_svg(key, logo) finally: @@ -55,16 +103,19 @@ def card_svg(key: str, logo: bytes, titles: dict[str, str]) -> str: def main() -> None: parser = argparse.ArgumentParser(description="Render the sharing cards to PNG.", allow_abbrev=False) - parser.add_argument("--only", choices=("sections", "platforms"), - help="render one kind of card (default: both)") + parser.add_argument("--only", choices=("sections", "platforms", "systems"), + help="render one kind of card (default: all)") args = parser.parse_args() try: from playwright.sync_api import sync_playwright except ImportError as exc: raise SystemExit("Playwright with Chromium is needed: pip install playwright") from exc - titles = platform_cards() - keys = [*([] if args.only == "platforms" else OG_SECTIONS), - *([] if args.only == "sections" else titles)] + titles: dict[str, tuple[str, str]] = {} + if args.only in (None, "platforms"): + titles.update(platform_cards()) + if args.only in (None, "systems"): + titles.update(system_cards()) + keys = [*(OG_SECTIONS if args.only in (None, "sections") else []), *titles] logo = LOGO.read_bytes() with sync_playwright() as playwright: browser = playwright.chromium.launch()