refactor: print sizes with one function

core.sizes.size_text replaces readme format_size, release record
size_text, render fmt_size, the large-files notes _mib and the handheld
_size. It prints one decimal in the largest unit reached, as the site
and the installer already did.

The README download table, the release notes and the large-files page
now say 29.2 MB where they said 29 MB, a handheld archive says 85.3 KB
where it said 85 KB, and a large-files asset under 1 MB is given in KB.
This commit is contained in:
Abdessamad Derraz committed 2026-11-20 20:03:26 +01:00
1 parent 3a76cf48ba
commit ab0805e6cb
19 files changed
+60 -71

No files matched your search

+2 -2
View File
@@ -9,6 +9,7 @@ from collections.abc import Callable, Sequence
from dataclasses import dataclass
from core.hashing import parse_hash_list
from core.sizes import size_text
from model.systemnames import system_name
from packs.crossref import FileConsumers
from sitegen import entries as siteentries, markup, measurements as sitemeasurements
@@ -48,7 +49,6 @@ from sitegen.render import (
code_span,
count_text,
escape_tags,
fmt_size,
card_page,
record_emulator_cards,
)
@@ -253,7 +253,7 @@ def _data_member_table(members: dict[str, dict], names: list[str], anchors: set[
anchor = f"sha1-{sha1[:12]}"
span = "" if anchor in anchors else f'<span id="{anchor}"></span>'
anchors.add(anchor)
table.append(f"| {span}{code_span(member)} | {fmt_size(int(info.get('size', 0)))} | {code_span(sha1)} |")
table.append(f"| {span}{code_span(member)} | {size_text(int(info.get('size', 0)))} | {code_span(sha1)} |")
return table