From 1cbb2a40c886603a2e2ccc883179cc2d196280e1 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 11 May 2025 21:38:22 -0600 Subject: make rules in html linkable --- html/Makefile | 13 ++++++++++++- html/link.svg | 1 + html/template.html | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 html/link.svg (limited to 'html') diff --git a/html/Makefile b/html/Makefile index e28c9dee..5c462103 100644 --- a/html/Makefile +++ b/html/Makefile @@ -26,6 +26,8 @@ GENERATE_CARD_LISTING := $(GAME_ROOT)/scripts/generate_card_listing.py GENERATE_HOVER_LINKS := $(GAME_ROOT)/scripts/generate_card_hover_links.py +PREPARE_RULES := $(GAME_ROOT)/scripts/prepare_html_rules.py + SETS := $(shell find $(CARDS_YML_DIR) -mindepth 1 -type d -printf "%f\n") SETS_SOURCEDIRS := $(foreach set, $(SETS), $(addprefix $(CARDS_YML_DIR)/, $(set))) @@ -123,6 +125,15 @@ $(1)/%.html: %.md $(MAKEFILE_LIST) $(HTML_TEMPLATE) $(GENERATE_HOVER_LINKS) else $(GENERATE_HOVER_LINKS) $$< | pandoc $(PANDOC_FLAGS) $(2) -o $$@; fi endef +define generateRulesHtml +$(1)/%.html: %.md $(MAKEFILE_LIST) $(HTML_TEMPLATE) $(GENERATE_HOVER_LINKS) + @echo "building $$@" + @if test \( ! \( -d $$(@D) \) \); then mkdir -p $$(@D);fi + $(VERBOSE) if [[ $$$$(cat $$< | wc -l) -gt 80 ]]; \ + then $(GENERATE_HOVER_LINKS) $$< | pandoc --toc $(PANDOC_FLAGS) $(2) | $(PREPARE_RULES) > $$@; \ + else $(GENERATE_HOVER_LINKS) $$< | pandoc $(PANDOC_FLAGS) $(2) | $(PREPARE_RULES) > $$@; fi +endef + $(eval $(call generateHtml, $(BUILDDIR),)) -$(eval $(call generateHtml, $(BUILDDIR)/rules, -N)) +$(eval $(call generateRulesHtml, $(BUILDDIR)/rules, -N)) $(eval $(call generateHtml, $(BUILDDIR)/blog,)) diff --git a/html/link.svg b/html/link.svg new file mode 100644 index 00000000..f0fdbf4f --- /dev/null +++ b/html/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/html/template.html b/html/template.html index bae64042..6d58af7d 100644 --- a/html/template.html +++ b/html/template.html @@ -250,6 +250,11 @@ $if(toc)$ padding-left: 10px; } $endif$ + +li.linkable-rule:active, li.linkable-rule:hover { + background-color: #d79921; + list-style-image: url(link.svg); +} $for(css)$ @@ -265,6 +270,26 @@ $endif$ $for(header-includes)$ $header-includes$ $endfor$ + $for(include-before)$ -- cgit v1.2.3