Skip to content

The card markup is parsed by three independent regexes #114

Description

@realmarcin

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions