fix: every accepted md5 is its own search word

Recalbox lists accepted md5s joined by commas, and platform pages printed the list as one code span. The site search took it for a single word, so 198 accepted values could not be found. Each value now has its own span.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 05:52:59 +02:00
1 parent dec0fdc163
commit 77ae9a7f74
2 files changed
+18 -2

No files matched your search

+5 -2
View File
@@ -1768,10 +1768,13 @@ def _render_platform_systems(
sha256 = str(cfg_entry.get("sha256") or "")
if sha1 or md5 or crc32 or sha256:
hash_parts = []
# One code span per value: Recalbox lists accepted md5s joined
# by commas, and the search indexed the joined run as a single
# word, so the second and later values were never found.
if sha1:
hash_parts.append(f"SHA1: `{sha1}`")
hash_parts.append(f"SHA1: {_hash_spans(sha1)}")
if md5:
hash_parts.append(f"MD5: `{md5}`")
hash_parts.append(f"MD5: {_hash_spans(md5)}")
if crc32:
hash_parts.append(f"CRC32: `{crc32}`")
if sha256:
+13
View File
@@ -756,5 +756,18 @@ class ACitationSaysWhoseCodeItIs(unittest.TestCase):
"`emu/memory.c:46` (upstream emulator)")
class EveryAcceptedHashIsItsOwnWord(unittest.TestCase):
"""Recalbox md5 lists rendered as one comma-joined code span: the site
search made one token of it and found none but the first."""
def test_a_list_is_split(self):
from generate_site import _hash_spans
md5s = ["96cf" + "0" * 28, "d5af" + "0" * 28]
text = _hash_spans(",".join(md5s))
for md5 in md5s:
self.assertIn(f"`{md5}`</span>", text)
if __name__ == "__main__":
unittest.main()