fix: describe platform pages by what they give

The meta description of each platform page was its summary followed by the label of a link, "ROCKNIX website.", and never said the page gives the BIOS files, their folder and the install command.
This commit is contained in:
Abdessamad Derraz committed 2026-11-05 19:34:19 +01:00
1 parent 1ad6570468
commit 564bfe8b18
2 files changed
+16

No files matched your search

+6
View File
@@ -2516,6 +2516,12 @@ def _page_description(markdown: str, relative: Path, title: str) -> str:
return _system_description(markdown, browser)
if key.startswith("emulators/") and relative.stem != "index":
return _emulator_description(markdown, key, title, _first_paragraph(lead))
if key.startswith("platforms/") and relative.stem != "index":
# The summary ends on a link to the platform's site, whose label
# alone was left: "A system for handhelds. ROCKNIX website."
summary = _first_paragraph(lead).removesuffix(f" {title} website.")
return _shorten(f"The BIOS files for {title}, the folder they go in and the "
f"command that installs them. {summary}", 155)
first = _first_paragraph(lead, minimum=35)
questions = [_plain_markdown(re.sub(r"\s*\{[^}]*\}\s*$", "", heading))
for heading in re.findall(r"^## (.+\?)(?:[ \t]*\{[^}]*\})?[ \t]*$", markdown, re.M)]
+10
View File
@@ -245,6 +245,16 @@ class Descriptions(unittest.TestCase):
self.assertEqual(gs._page_description(body, key, "DaedalusX64"),
"DaedalusX64 emulates Nintendo 64. Every file it reads comes with the app.")
def test_a_platform_page_says_what_it_gives(self) -> None:
"""All 18 ended on the label of a link a snippet cannot follow,
"ROCKNIX website.", and never named the BIOS files or their folder."""
body = ("# ROCKNIX\n\nA system for handhelds. [ROCKNIX website](https://rocknix.org).\n\n"
"## On the device { #install }\n")
self.assertEqual(
gs._page_description(body, Path("platforms/rocknix.md"), "ROCKNIX"),
"The BIOS files for ROCKNIX, the folder they go in and the command that installs "
"them. A system for handhelds.")
def test_a_console_page_is_described_by_its_start_line(self) -> None:
body = "# Sega: Dreamcast\n\nPart of Sega.\n\n**Start with**: `dc_boot.bin`, `dc_flash.bin`.\n"
text = gs._page_description(body, Path("systems/sega-dreamcast.md"), "Sega: Dreamcast")