aboutsummaryrefslogtreecommitdiff
path: root/html
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2022-01-04 14:39:57 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2022-01-04 14:39:57 +0100
commit0c797df47f0e65f6aeadd917e21ca580866723de (patch)
tree9d4666d7f64b44f21e3f94467e0ff6cad1f7a5bc /html
parent791a83da34ff35f7dc159e7f8d5f060f02c6bc5a (diff)
downloadmuhqs-game-0c797df47f0e65f6aeadd917e21ca580866723de.tar.gz
muhqs-game-0c797df47f0e65f6aeadd917e21ca580866723de.zip
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.
Diffstat (limited to 'html')
-rw-r--r--html/Makefile12
1 files changed, 4 insertions, 8 deletions
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 $$@"