mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 10:23:16 -05:00
fix: print profile hashes whole on the site
This commit is contained in:
1 parent
481b8eb5f9
commit
c91a22ee7d
3 files changed
+28
-5
No files matched your search
@@ -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 */
|
||||
|
||||
@@ -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'<span class="rb-hash" title="{v}">`{v[:12]}...`</span>' for v in values
|
||||
f'<span class="rb-hash">{_code(v)}</span>' for v in parse_hash_list(value)
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
Reference in new issue
Block a user