From 93911faccb27ac11f3d4a1fdc098ebb6255d5612 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 3 Aug 2022 16:23:32 +0200 Subject: Website gen adjustments --- Makefile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 863fca1..52a90f9 100644 --- a/Makefile +++ b/Makefile @@ -50,13 +50,13 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \ $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -maxdepth 1 -type f -name "*.md" ! -name "index.md") \ $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -mindepth 2 -maxdepth 2 -type f -name "index.md")) -.cache/meta/%.json: content/%.md $$(call subpages,$$(call namespace,$$@,)) filters/*.lua scripts/subpages.lua scripts/subpages.jq scripts/metadata.json | .cache/meta +.cache/meta/%.json: content/%.md $$(call subpages,$$(call namespace,$$@,)) filters/*.lua scripts/pages_content.lua scripts/subpages.jq scripts/metadata.json | .cache/meta $(info [META] $< -> $@) mkdir -p $(@D) $(eval PAGES_FILES = $(filter .cache/meta/%.json,$^)) $(eval NAMESPACE = $(call namespace,$@,.cache/meta)) - $(if $(PAGES_FILES),jq -s --arg namespace "$(NAMESPACE)" -f scripts/subpages.jq $(PAGES_FILES) > "$@.pages",echo "{}" > "$@.pages") + $(if $(PAGES_FILES),jq -s --arg namespace "$(NAMESPACE)" -f scripts/subpages.jq $(PAGES_FILES) > "$@.pages",echo "{ \"pages\": [] }" > "$@.pages") pandoc \ -f markdown-citations-implicit_figures \ -t html5 \ @@ -65,7 +65,7 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \ --metadata-file "$@.pages" \ --template scripts/metadata.json \ --metadata namespace="$(NAMESPACE)" \ - --metadata file_out="$(patsubst .cache/meta/%.json,out/%.html,$@)" \ + --metadata file_out="$(patsubst .cache/meta/%.json,/%.html,$@)" \ $(PANDOC_FILTERS) \ -o "$@.meta" "$<" rm "$@.pages" @@ -74,11 +74,11 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \ -t html5 \ --wrap preserve \ --lua-filter scripts/metadata.lua \ - --lua-filter scripts/subpages.lua \ + --lua-filter scripts/pages_content.lua \ $(GLOBAL_METADATA) \ --metadata-file "$@.meta" \ --metadata build.mode="$(MODE)" \ - --metadata build.file_out="$@" \ + --metadata build.file_out="$(patsubst .cache/meta/%.json,/%.html,$@)" \ $(PANDOC_FILTERS) \ -o "$@.content" "$<" jq '. + { content: $$content }' --rawfile content "$@.content" "$@.meta" > "$@" @@ -92,6 +92,7 @@ out/%.html: content/%.md .cache/meta/%.json .cache/assets.json $(CONTENT_TEMPLAT $(info [MARK] $< -> $@) mkdir -p $(@D) + $(eval NAMESPACE = $(call namespace,$@,.cache/meta)) pandoc \ -f markdown-citations-implicit_figures \ -t html5 \ @@ -103,7 +104,8 @@ out/%.html: content/%.md .cache/meta/%.json .cache/assets.json $(CONTENT_TEMPLAT --metadata-file .cache/assets.json \ --metadata-file "$(filter .cache/meta/%.json,$^)" \ --metadata build.mode="$(MODE)" \ - --metadata build.file_out="$@" \ + --metadata build.namespace="$(NAMESPACE)" \ + --metadata build.file_out="$(patsubst out/%,/%,$@)" \ $(PANDOC_FILTERS) \ -o "$@" "$<" @@ -111,6 +113,7 @@ out/%.xml: content/%.md .cache/meta/%.json $(FEED_TEMPLATES_SRC) metadata/*.yaml $(info [FEED] $< -> $@) mkdir -p $(@D) + $(eval NAMESPACE = $(call namespace,$@,.cache/meta)) pandoc \ -f markdown-citations-implicit_figures \ -t html5 \ @@ -121,7 +124,8 @@ out/%.xml: content/%.md .cache/meta/%.json $(FEED_TEMPLATES_SRC) metadata/*.yaml $(GLOBAL_METADATA) \ --metadata-file "$(filter .cache/meta/%.json,$^)" \ --metadata build.mode="$(MODE)" \ - --metadata build.file_out="$@" \ + --metadata build.namespace="$(NAMESPACE)" \ + --metadata build.file_out="$(patsubst out/%,/%,$@)" \ $(PANDOC_FILTERS) \ -o "$@" "$<" -- cgit v1.2.3-70-g09d2