diff --git a/scripts/sitegen/consolecards.py b/scripts/sitegen/consolecards.py index 47dc7dde1..b57b8410b 100644 --- a/scripts/sitegen/consolecards.py +++ b/scripts/sitegen/consolecards.py @@ -23,8 +23,10 @@ SYSTEM_PAGE_BUDGET = 300_000 # Manufacturers whose every console gets a page of its own, whatever its # size. A section shares its page's search fields with its neighbours, and # a digit is on too many pages to weigh: "playstation 3 bios" found the -# PlayStation page before the Sony page that held the PlayStation 3. -CONSOLE_PAGES = frozenset({"Sony"}) +# PlayStation page before the Sony page that held the PlayStation 3, and +# "gba bios" landed on mGBA's page, the Game Boy Advance being a section of +# the Nintendo page. +CONSOLE_PAGES = frozenset({"Nintendo", "Sony"}) # What the sections kept on a manufacturer's summary may weigh once # rendered, estimated from their Markdown. Fitted on the Nintendo, Sega and # Commodore summaries: highlighted install commands grow about eleven times diff --git a/tests/test_site_components.py b/tests/test_site_components.py index 4b8ce1327..a473d1771 100644 --- a/tests/test_site_components.py +++ b/tests/test_site_components.py @@ -746,20 +746,49 @@ class SearchConsoleOwnership(unittest.TestCase): (DIST / "index.html").read_text(encoding="utf-8")) +NINTENDO_CONSOLES = ( + "nintendo-3ds", "nintendo-famicom-disk-system", "nintendo-game-boy", + "nintendo-game-boy-advance", "nintendo-game-boy-color", "nintendo-gamecube", + "nintendo-nes", "nintendo-nintendo-64", "nintendo-nintendo-64dd", "nintendo-nintendo-ds", + "nintendo-nintendo-dsi", "nintendo-pokemon-mini", "nintendo-satellaview", "nintendo-snes", + "nintendo-sufami-turbo", "nintendo-super-famicom-box", "nintendo-super-game-boy", + "nintendo-switch", "nintendo-wii", "nintendo-wii-u", +) + + class EverySonyConsoleHasItsPage(unittest.TestCase): """A section shares its page's search fields: "playstation 3 bios" - found the PlayStation page before the Sony page holding the PS3.""" + found the PlayStation page before the Sony page holding the PS3, and + "gba bios" landed on mGBA's page, the Game Boy Advance being a section + of the Nintendo page.""" - def test_sony_is_split_by_console(self): + def test_sony_and_nintendo_are_split_by_console(self): source = script_source("generate_site.py") - self.assertIn('CONSOLE_PAGES = frozenset({"Sony"})', source) + self.assertIn('CONSOLE_PAGES = frozenset({"Nintendo", "Sony"})', source) self.assertIn("manufacturer in CONSOLE_PAGES", source) + def test_the_game_boy_advance_page_and_its_section(self): + docs = WEBSITE / "src" / "content" / "docs" + page = docs / "systems" / "nintendo-game-boy-advance.mdx" + if not page.is_file(): + self.skipTest("site not generated") + text = page.read_text(encoding="utf-8") + self.assertIn("content: Game Boy Advance BIOS files (Nintendo) - RetroBIOS", text) + self.assertIn("/retrobios/emulators/mgba/", text) + # The section keeps its anchor on the Nintendo page and leads here. + summary = (docs / "systems" / "nintendo.md").read_text(encoding="utf-8") + section = summary.split("## Game Boy Advance { #game-boy-advance }", 1)[1] + self.assertIn("(/retrobios/systems/nintendo-game-boy-advance/)", + section.split("\n## ", 1)[0]) + mgba = next((docs / "emulators").glob("mgba.md*")).read_text(encoding="utf-8") + self.assertIn("systems/nintendo-game-boy-advance/", mgba) + self.assertNotIn("systems/nintendo/#game-boy-advance", mgba) + @unittest.skipUnless((DIST / "index.html").is_file(), "site not built") def test_each_console_page_is_built(self): for slug in ("sony-playstation", "sony-playstation-2", "sony-playstation-3", "sony-playstation-4", "sony-playstation-portable", "sony-playstation-vita", - "sony-pocketstation"): + "sony-pocketstation", *NINTENDO_CONSOLES): with self.subTest(page=slug): self.assertTrue((DIST / "systems" / slug / "index.html").is_file()) diff --git a/tests/test_site_search.py b/tests/test_site_search.py index 37b53f2d8..be1c672fc 100644 --- a/tests/test_site_search.py +++ b/tests/test_site_search.py @@ -551,11 +551,12 @@ class GateQueries(unittest.TestCase): "playstation 2 bios": (("systems/sony-playstation-2/",), 1), "playstation 3 bios": (("systems/sony-playstation-3/",), 2), "ps3 bios": (("systems/sony-playstation-3/",), 1), - "game boy advance bios": (("systems/nintendo/",), 1), - "game boy color bios": (("systems/nintendo/",), 1), + "game boy advance bios": (("systems/nintendo-game-boy-advance/",), 1), + "game boy color bios": (("systems/nintendo-game-boy-color/",), 1), + "gba bios": (("systems/nintendo-game-boy-advance/",), 3), "nintendo ds bios": (("systems/nintendo-nintendo-ds/",), 1), "nintendo dsi bios": (("systems/nintendo-nintendo-dsi/",), 1), - "wii bios": (("systems/nintendo/",), 1), + "wii bios": (("systems/nintendo-wii/",), 1), "wii u bios": (("systems/nintendo-wii-u/",), 1), "saturn bios": (("systems/sega-saturn/",), 1), "check my bios folder": (("wiki/troubleshooting/",), 3), diff --git a/tests/test_site_system_links.py b/tests/test_site_system_links.py index 0793331ba..735196f53 100644 --- a/tests/test_site_system_links.py +++ b/tests/test_site_system_links.py @@ -150,10 +150,12 @@ class AnIdNamesOneCardPerPage(unittest.TestCase): def test_the_second_card_has_no_id(self): from packs.crossref import FileConsumers + # Sega keeps small consoles on its page: Nintendo and Sony give every + # console a page of its own (CONSOLE_PAGES). entry = {"name": "a.bin", "sha1": "a" * 40, "md5": "b" * 32, "size": 3, - "path": "bios/Nintendo/DS/a.bin"} + "path": "bios/Sega/Mega CD/a.bin"} page = systempages.generate_system_page( - "Nintendo", {"DS": [entry], "DSi": [entry]}, FileConsumers({"files": {}})) + "Sega", {"Mega CD": [entry], "Mega Drive": [entry]}, FileConsumers({"files": {}})) self.assertEqual(page.count('id="sha1-aaaaaaaaaaaa" class="rb-file-title"'), 1) self.assertEqual(page.count("rb-sys-file"), 2) diff --git a/tests/test_site_systems.py b/tests/test_site_systems.py index 3ed836e53..84ef39b61 100644 --- a/tests/test_site_systems.py +++ b/tests/test_site_systems.py @@ -621,9 +621,15 @@ class TheBuiltSystemPages(unittest.TestCase): self.assertNotRegex(opening.casefold(), r"dsi_|bios7i|bios9i") def test_the_gba_line_prints_the_setups_name(self) -> None: + """On the Nintendo page, whose section now leads to the console's + own page, and on that page above its first card.""" page = (DIST / "systems" / "nintendo" / "index.html").read_text(encoding="utf-8") section = page[page.index('id="game-boy-advance"'):page.index('id="game-boy-color"')] - self.assertRegex(section[:section.index("class=\"rb-sys-file\"")], r"]*>gba_bios.bin") + own = (DIST / "systems" / "nintendo-game-boy-advance" / "index.html").read_text( + encoding="utf-8") + for opening in (section.split('class="rb-sys-file"')[0], + own.split('class="rb-sys-file"')[0]): + self.assertRegex(opening, r"]*>gba_bios.bin") def test_the_neo_geo_section_opens_on_the_neo_geo_bios(self) -> None: page = (DIST / "systems" / "snk" / "index.html").read_text(encoding="utf-8") diff --git a/website/src/data/published-parts.json b/website/src/data/published-parts.json index bd66db8bb..e7ffd040b 100644 --- a/website/src/data/published-parts.json +++ b/website/src/data/published-parts.json @@ -308,14 +308,25 @@ "systems/microsoft-msx-2.md": "systems/microsoft.md", "systems/microsoft-msx.md": "systems/microsoft.md", "systems/nintendo-3ds.md": "systems/nintendo.md", + "systems/nintendo-famicom-disk-system.md": "systems/nintendo.md", + "systems/nintendo-game-boy-advance.md": "systems/nintendo.md", + "systems/nintendo-game-boy-color.md": "systems/nintendo.md", "systems/nintendo-game-boy.md": "systems/nintendo.md", "systems/nintendo-gamecube.md": "systems/nintendo.md", "systems/nintendo-nes.md": "systems/nintendo.md", + "systems/nintendo-nintendo-64.md": "systems/nintendo.md", "systems/nintendo-nintendo-64dd.md": "systems/nintendo.md", "systems/nintendo-nintendo-ds.md": "systems/nintendo.md", "systems/nintendo-nintendo-dsi.md": "systems/nintendo.md", + "systems/nintendo-pokemon-mini.md": "systems/nintendo.md", + "systems/nintendo-satellaview.md": "systems/nintendo.md", "systems/nintendo-snes.md": "systems/nintendo.md", + "systems/nintendo-sufami-turbo.md": "systems/nintendo.md", + "systems/nintendo-super-famicom-box.md": "systems/nintendo.md", + "systems/nintendo-super-game-boy.md": "systems/nintendo.md", + "systems/nintendo-switch.md": "systems/nintendo.md", "systems/nintendo-wii-u.md": "systems/nintendo.md", + "systems/nintendo-wii.md": "systems/nintendo.md", "systems/other-altirra.md": "systems/other.md", "systems/other-armsx2.md": "systems/other.md", "systems/other-c64-emu.md": "systems/other.md", diff --git a/website/tools/search_gate.py b/website/tools/search_gate.py index 4ed41a265..a2238003a 100644 --- a/website/tools/search_gate.py +++ b/website/tools/search_gate.py @@ -62,7 +62,7 @@ QUERIES: dict[str, tuple[tuple[str, ...], int]] = { # of its page. Flycast's page names dc_boot.bin and where it goes. "psx bios": (("systems/sony",), 3), "dc bios missing": (("systems/sega", "emulators/flycast/"), 3), - "gba bios": (("systems/nintendo",), 3), + "gba bios": (("systems/nintendo-game-boy-advance/",), 3), # A console whose page answers "No file needed" says BIOS only where the # search does not read: its `terms` field carries " BIOS". "snes bios": (("systems/nintendo-snes/",), 1), @@ -71,21 +71,20 @@ QUERIES: dict[str, tuple[tuple[str, ...], int]] = { "game boy bios": (("systems/nintendo-game-boy/",), 1), "3ds bios": (("systems/nintendo-3ds/",), 1), # A console another one's name begins with, both ways: the longer name's - # page holds every word of the shorter query. GBA and GBC are sections - # of their maker's page. Saturn.emu is an emulator named after its - # console. + # page holds every word of the shorter query. Saturn.emu is an emulator + # named after its console. "playstation 2 bios": (("systems/sony-playstation-2/",), 1), - # Every Sony console has a page of its own (CONSOLE_PAGES). The search - # weighs words, not their order, and "3" is on too many pages to weigh: - # the PlayStation page, which names BIOS v3.0 and leads "playstation - # bios", stays just above. "ps3 bios" finds the page first. + # Every Sony and Nintendo console has a page of its own (CONSOLE_PAGES). + # The search weighs words, not their order, and "3" is on too many pages + # to weigh: the PlayStation page, which names BIOS v3.0 and leads + # "playstation bios", stays just above. "ps3 bios" finds the page first. "playstation 3 bios": (("systems/sony-playstation-3/",), 2), "ps3 bios": (("systems/sony-playstation-3/",), 1), - "game boy advance bios": (("systems/nintendo/",), 1), - "game boy color bios": (("systems/nintendo/",), 1), + "game boy advance bios": (("systems/nintendo-game-boy-advance/",), 1), + "game boy color bios": (("systems/nintendo-game-boy-color/",), 1), "nintendo ds bios": (("systems/nintendo-nintendo-ds/",), 1), "nintendo dsi bios": (("systems/nintendo-nintendo-dsi/",), 1), - "wii bios": (("systems/nintendo/",), 1), + "wii bios": (("systems/nintendo-wii/",), 1), "wii u bios": (("systems/nintendo-wii-u/",), 1), "saturn bios": (("systems/sega-saturn/",), 1), # The words an emulator prints, and the page that answers them.