From 0c797df47f0e65f6aeadd917e21ca580866723de Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 4 Jan 2022 14:39:57 +0100 Subject: use python to generate card listings The previous make/shell based approach results in only a single placeholder id 'placeholder-0' because we invoke generate_card.py for each card which will initialize the placeholder id count each time with 0. Now we generate the whole car listing in python which greatly reduces the number of program invocations and allows the placeholder id to be incremented for each listed card. --- html/Makefile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'html') diff --git a/html/Makefile b/html/Makefile index e4c09aab..83740d14 100644 --- a/html/Makefile +++ b/html/Makefile @@ -20,6 +20,8 @@ LATEX_BUILDDIR := $(LATEX_ROOT)/build GENERATE_CARD := $(GAME_ROOT)/scripts/generate_card.py GENERATE_CARD_ARGS := --format markdown +GENERATE_CARD_LISTING := $(GAME_ROOT)/scripts/generate_card_listing.py + GENERATE_HOVER_LINKS := $(GAME_ROOT)/scripts/generate_card_hover_links.py SETS := $(shell find $(CARDS_YML_DIR) -mindepth 1 -type d -printf "%f\n") @@ -88,17 +90,11 @@ $(BUILDDIR)/cards-data: $(LANG_CARDS_LISTINGS) $(BUILDDIR)/latex-build $(VERBOSE) ln -sfT $(DATA_ROOT)/cards $@ define generateCardsListing -$(1)/cards_listing.md: $(CARDS_YAML) $(GENERATE_CARD) $(MAKEFILE_LIST) +$(1)/cards_listing.md: $(CARDS_YAML) $(GENERATE_CARD) $(GENERATE_CARD_LISTING) $(MAKEFILE_LIST) @echo "building $$@" @if test \( ! \( -d $$(@D) \) \) ;then mkdir -p $$(@D);fi $(VERBOSE) echo -e "% Cards" > $$@ - $(VERBOSE) for set in $(SETS); \ - do echo -e "\n## [$$$$set](../cards/$(2)/$$$$set.pdf)" >> $$@; \ - for card in $(CARDS_YML_DIR)/$$$$set/*.yml; \ - do echo "" >> $$@; \ - $(GENERATE_CARD) $(GENERATE_CARD_ARGS) --language=$(2) $$$$card >> $$@; \ - done; \ - done + $(VERBOSE) $(GENERATE_CARD_LISTING) --language=$(2) $(CARDS_YML_DIR) >> $$@; $(1)/cards_listing.html: $(1)/cards_listing.md $(HTML_TEMPLATE) @echo "building $$@" -- cgit v1.2.3