refactor: count nouns through core.text

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:03:21 +01:00
1 parent 4585e3ffea
commit 77ba6868a0
7 files changed
+60 -28

No files matched your search

+1 -5
View File
@@ -11,6 +11,7 @@ from model import siteinputs
from sitegen import markup
from core.memo import DerivedView
from core.paths import REPO_ROOT
from core.text import count_text as count_text
from model.collection import PROGRAM_TOPS, card_moves, manufacturer_slug
from model.systemnames import (
SYSTEM_PARENTS,
@@ -59,11 +60,6 @@ def card_anchor(sha1: str) -> str:
return f"sha1-{sha1[:SHORT_HASH]}"
def count_text(number: int, noun: str, plural: str = "") -> str:
"""A count and its noun, singular for one: the site printed "1 files" 234 times."""
return f"{number:,} {noun if number == 1 else plural or noun + 's'}"
def escape_tags(text: str) -> str:
"""Show a placeholder such as ``<system_dir>`` as it was written.