From the review of #109.
The <article data-mech="…"> … <div class="num"><b>N</b> markup in _fleet/mechs_template.md is now read by:
assemble_page.py — CARD_RECORDS for the numbers and a separate data-mech findall for the names;
tests/test_fleet_page.py — imports CARD_RECORDS and mutates the markup by string replacement;
scripts/fleet/check_cards.py — its own CARD regex pairing name and number.
A change to the card markup has to be made in three places, and check_cards.CARD pairs a name with the next number via a non-greedy .*?, so a card missing its number would silently take its neighbour's. The test that pins cards() against the manifest catches a missing member but not a swapped pairing.
One parser in assemble_page.py that yields (mech, count) pairs, used by all three, would remove the duplication. Low priority; nothing is wrong today.
From the review of #109.
The
<article data-mech="…"> … <div class="num"><b>N</b>markup in_fleet/mechs_template.mdis now read by:assemble_page.py—CARD_RECORDSfor the numbers and a separatedata-mechfindall for the names;tests/test_fleet_page.py— importsCARD_RECORDSand mutates the markup by string replacement;scripts/fleet/check_cards.py— its ownCARDregex pairing name and number.A change to the card markup has to be made in three places, and
check_cards.CARDpairs a name with the next number via a non-greedy.*?, so a card missing its number would silently take its neighbour's. The test that pinscards()against the manifest catches a missing member but not a swapped pairing.One parser in
assemble_page.pythat yields(mech, count)pairs, used by all three, would remove the duplication. Low priority; nothing is wrong today.