feat: order system cards and show their facts

Required BIOS first with a Start with line by region, a fact grid with
setup display names and a key, a link icon in place of the word
permalink, a console table on the systems index.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 02:31:14 +02:00
1 parent 2098b7a955
commit 7d0fc83206
4 files changed
+386 -113

No files matched your search

+1 -1
View File
@@ -4963,7 +4963,7 @@ class CollectionCardsCarryFullHashes(unittest.TestCase):
"crc32": "504086c1", "sha256": "b" * 64}
text = "\n".join(_system_file_card(entry, FileConsumers({}, {})))
for value in (entry["sha1"], entry["md5"], entry["crc32"], entry["sha256"]):
self.assertIn(f">{value}</code>", text)
self.assertIn(f'<span class="rb-hash">{value}</span>', text)
+10 -9
View File
@@ -358,10 +358,11 @@ class AVariantShowsWhoPinsIt(unittest.TestCase):
page = generate_site.generate_system_page(
"Entex", {"Adventure Vision": [primary, variant]}, consumers)
block = page[page.index("<summary>Variants (1)</summary>"):]
self.assertIn("- Collection path: `bios/Entex/Adventure Vision/.variants/advision.zip.1c086064`", block)
self.assertIn("[batocera](../platforms/batocera.md)", block)
self.assertIn("[retrobat](../platforms/retrobat.md)", block)
self.assertIn('<code class="rb-hash">' + "c" * 40 + "</code>", block)
self.assertIn("<dt>Collection path</dt><dd><code>bios/Entex/Adventure Vision/"
".variants/advision.zip.1c086064</code>", block)
self.assertIn('<a href="../platforms/batocera.md">Batocera</a>', block)
self.assertIn('<a href="../platforms/retrobat.md">RetroBat</a>', block)
self.assertIn('<span class="rb-hash">' + "c" * 40 + "</span>", block)
self.assertIn("Catalogued", block)
@@ -461,7 +462,7 @@ class ASystemCardLandsOnThePlatformsSection(unittest.TestCase):
)
self.assertEqual(
_platform_links("s", consumers),
["[retrodeck](../platforms/retrodeck.md#sony-playstation) `bios/scph5000.bin`"],
["[RetroDECK](../platforms/retrodeck.md#sony-playstation): `bios/scph5000.bin`"],
)
@@ -745,7 +746,7 @@ class ACardNamesThePacksThatInstallIt(unittest.TestCase):
import json as _json
from cross_reference import FileConsumers
from generate_site import _installed_links
from generate_site import _installed_places
with tempfile.TemporaryDirectory(dir=ROOT / "tmp") as tmp:
Path(tmp, "retrobat.json").write_text(_json.dumps({
@@ -755,9 +756,9 @@ class ACardNamesThePacksThatInstallIt(unittest.TestCase):
}))
consumers = FileConsumers({"files": {}})
consumers.add_manifests(tmp)
links = _installed_links("a" * 40, consumers, set())
self.assertEqual(links, ["[retrobat](../platforms/retrobat.md) `scph5501.bin`"])
self.assertEqual(_installed_links("a" * 40, consumers, {"retrobat"}), [])
places = _installed_places("a" * 40, consumers, set())
self.assertEqual(places, [("RetroBat", "../platforms/retrobat.md", ["scph5501.bin"])])
self.assertEqual(_installed_places("a" * 40, consumers, {"retrobat"}), [])
class ProseCitationsLinkToThePin(unittest.TestCase):
+8 -7
View File
@@ -2,6 +2,7 @@
from __future__ import annotations
import re
import sys
import tempfile
import unittest
@@ -354,15 +355,15 @@ class TheSearchSkipsLinkLists(unittest.TestCase):
consumers.installed = {sha1: {"batocera": {"bios/a.bin"}}}
consumers.emulators = {sha1: {"duckstation"}}
entry = {"name": "a.bin", "sha1": sha1, "md5": "b" * 32, "size": 3}
text = "\n".join(generate_site._system_file_card(entry, consumers))
searched, _sep, skipped = text.partition("<section data-pagefind-ignore>")
self.assertIn("<code>a.bin</code>", searched)
self.assertNotIn("- MD5:", searched)
for line in ("- MD5:", "- Emulators:", "- Also installed by:"):
self.assertIn(line, skipped)
lines = generate_site._system_file_card(entry, consumers)
self.assertIn("<code>a.bin</code>", lines[2])
rows = {re.search(r"<dt>(.*?)</dt>", line)[1]: line for line in lines
if line.startswith("<div") and "<dt>" in line}
for label in ("MD5", "Emulators", "Packed for its emulators by"):
self.assertTrue(rows[label].startswith("<div data-pagefind-ignore>"), label)
# The platforms line names the file as each setup does: the site
# search reads it, so a file name finds its card.
self.assertIn("- Platforms:", searched + skipped.split("</section>", 1)[1])
self.assertTrue(rows["On the setup's list"].startswith("<div><dt>"))
def test_a_game_data_card_skips_its_name_too(self):
import generate_site