refactor: cut site pages in parts in sitegen.parts

card_runs, the share loop, the card weight and the part stems and links were copied in startwith, systempages, emulatorpage and platformfiles. sitegen.parts gives weighted_runs, even_runs, part_stems and part_links; the cuts are unchanged for every block list the site passes.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:02:44 +01:00
1 parent 53d49bd002
commit e79d2404bc
5 files changed
+67 -62

No files matched your search

-16
View File
@@ -13,7 +13,6 @@ from sitegen.cards import ROMSET_FAQ, emulator_display, romset_releases
from sitegen.consolecards import (
Card,
START_WITH_NAMES,
Item,
NO_PRIORITY,
add_name,
card_rank,
@@ -693,21 +692,6 @@ def cards_markdown(cards: list[Card]) -> list[str]:
return lines
def card_runs(cards: list[Item], budget: int, sizes: list[int]) -> list[list[Item]]:
"""Cards in runs of at most ``budget`` bytes, in order, ``sizes``
giving each card's weight."""
parts: list[list[Item]] = [[]]
size = 0
for index, card in enumerate(cards):
weight = sizes[index]
if parts[-1] and size + weight > budget:
parts.append([])
size = 0
parts[-1].append(card)
size += weight
return parts
def console_heading(manufacturer: str, console: str, label: str = "") -> str:
"""A console's heading, its name alone. An icon on 79 of 544 headings
read as missing art on the rest, set the text at two positions on one