From c91a22ee7d9f605b618a31d2b79f84133522c4a5 Mon Sep 17 00:00:00 2001
From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com>
Date: Sun, 18 Oct 2026 17:12:03 +0200
Subject: [PATCH] fix: print profile hashes whole on the site
---
docs_assets/extra.css | 4 ++--
scripts/generate_site.py | 12 +++++++++---
tests/test_site_exports.py | 17 +++++++++++++++++
3 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/docs_assets/extra.css b/docs_assets/extra.css
index 499487b6..148a8680 100644
--- a/docs_assets/extra.css
+++ b/docs_assets/extra.css
@@ -385,13 +385,13 @@
margin: 0.15rem 0;
}
-/* ── Hash display (truncated with tooltip) ── */
+/* ── Hash display: printed whole so the search finds it, wrapped on phones ── */
.rb-hash {
font-family: monospace;
font-size: 0.78rem;
color: var(--rb-text-secondary);
- cursor: help;
letter-spacing: -0.02em;
+ overflow-wrap: anywhere;
}
/* System page file cards */
diff --git a/scripts/generate_site.py b/scripts/generate_site.py
index b45fe615..73c4721d 100644
--- a/scripts/generate_site.py
+++ b/scripts/generate_site.py
@@ -2678,10 +2678,16 @@ def _render_structured_blocks(profile: dict) -> list[str]:
def _hash_spans(value: str | list) -> str:
- """One abbreviated hash, or each of the hashes a profile accepts."""
- values = [value] if isinstance(value, str) else [str(v) for v in value]
+ """Each hash a profile accepts, in full.
+
+ Cut to 12 characters with the rest in a title attribute, 208 hashes
+ that only a profile declares were out of reach of the site search: it
+ indexes text, and a pasted sha1 matched nothing.
+ """
+ from hashing import parse_hash_list # noqa: PLC0415
+
return ", ".join(
- f'`{v[:12]}...`' for v in values
+ f'{_code(v)}' for v in parse_hash_list(value)
)
diff --git a/tests/test_site_exports.py b/tests/test_site_exports.py
index b461dd1e..301c1210 100644
--- a/tests/test_site_exports.py
+++ b/tests/test_site_exports.py
@@ -385,5 +385,22 @@ class AFlaggedDumpIsNotVerified(unittest.TestCase):
self.assertEqual(_dump_flags("tosec", {"name": "x [o][b].bin"}), ["overdump", "bad dump"])
+
+class EmulatorPagesPrintWholeHashes(unittest.TestCase):
+ """Emulator pages cut every hash to 12 characters, the rest in a title
+ attribute the search does not index: bstone's AUDIOHED.BS1 sha1 pasted
+ whole found nothing."""
+
+ def test_full_and_split(self):
+ from generate_site import _hash_spans
+
+ sha1 = "0c3de403b524107809fa9308b730d60e8e41ba93"
+ self.assertIn(f"`{sha1}`", _hash_spans(sha1))
+ both = _hash_spans(f"{'a' * 64}, {'b' * 64}")
+ self.assertIn("`" + "a" * 64 + "`", both)
+ self.assertIn("`" + "b" * 64 + "`", both)
+ self.assertNotIn("...", both)
+
+
if __name__ == "__main__":
unittest.main()