diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 43 |
1 files changed, 28 insertions, 15 deletions
@@ -50,7 +50,7 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \ | |||
50 | $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -maxdepth 1 -type f -name "*.md" ! -name "index.md") \ | 50 | $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -maxdepth 1 -type f -name "*.md" ! -name "index.md") \ |
51 | $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -mindepth 2 -maxdepth 2 -type f -name "index.md")) | 51 | $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -mindepth 2 -maxdepth 2 -type f -name "index.md")) |
52 | 52 | ||
53 | .cache/meta/%.json: content/%.md $$(call subpages,$$(call namespace,$$@,)) filters/*.lua scripts/pages_content.lua scripts/subpages.jq scripts/metadata.json | .cache/meta | 53 | .cache/meta/%.json: content/%.md $$(call subpages,$$(call namespace,$$@,)) filters/*.lua scripts/content.lua scripts/subpages.jq scripts/metadata.json | .cache/meta |
54 | $(info [META] $< -> $@) | 54 | $(info [META] $< -> $@) |
55 | 55 | ||
56 | mkdir -p $(@D) | 56 | mkdir -p $(@D) |
@@ -73,57 +73,70 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \ | |||
73 | -f markdown-citations-implicit_figures \ | 73 | -f markdown-citations-implicit_figures \ |
74 | -t html5 \ | 74 | -t html5 \ |
75 | --wrap preserve \ | 75 | --wrap preserve \ |
76 | --lua-filter scripts/metadata.lua \ | 76 | --lua-filter scripts/content.lua \ |
77 | --lua-filter scripts/pages_content.lua \ | ||
78 | $(GLOBAL_METADATA) \ | 77 | $(GLOBAL_METADATA) \ |
79 | --metadata-file "$@.meta" \ | 78 | --metadata-file "$@.meta" \ |
80 | --metadata build.mode="$(MODE)" \ | ||
81 | --metadata build.file_out="$(patsubst .cache/meta/%.json,/%.html,$@)" \ | ||
82 | $(PANDOC_FILTERS) \ | 79 | $(PANDOC_FILTERS) \ |
83 | -o "$@.content" "$<" | 80 | -o "$@.content" "$<" |
84 | jq '. + { content: $$content }' --rawfile content "$@.content" "$@.meta" > "$@" | 81 | jq '. + { content: $$content }' --rawfile content "$@.content" "$@.meta" > "$@" |
85 | rm "$@.meta" | 82 | rm "$@.meta" |
86 | rm "$@.content" | 83 | rm "$@.content" |
87 | 84 | ||
85 | .cache/meta.json: .cache/meta/index.json scripts/metadata.lua | .cache | ||
86 | $(info [META] $@) | ||
87 | |||
88 | mkdir -p $(@D) | ||
89 | pandoc \ | ||
90 | -f markdown-citations-implicit_figures \ | ||
91 | -t html5 \ | ||
92 | --wrap preserve \ | ||
93 | --no-highlight \ | ||
94 | --lua-filter scripts/metadata.lua \ | ||
95 | $(GLOBAL_METADATA) \ | ||
96 | --metadata-file "$<" \ | ||
97 | --metadata build.mode="$(MODE)" \ | ||
98 | --template scripts/metadata.json \ | ||
99 | -o "$@" "$<" | ||
100 | |||
88 | .cache/assets.json: $(ASSET_FILES) | .cache | 101 | .cache/assets.json: $(ASSET_FILES) | .cache |
102 | $(info [ASET] $@) | ||
103 | |||
89 | sha256sum $^ | sed -r 's/([0-9a-f]+) +out\/(.*)/{ "\2": "\/\2?\1" }/' | jq '{ assets: [inputs] | add | with_entries( .key |= gsub( "\\."; "_") ) }' > "$@" | 104 | sha256sum $^ | sed -r 's/([0-9a-f]+) +out\/(.*)/{ "\2": "\/\2?\1" }/' | jq '{ assets: [inputs] | add | with_entries( .key |= gsub( "\\."; "_") ) }' > "$@" |
90 | 105 | ||
91 | out/%.html: content/%.md .cache/meta/%.json .cache/assets.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/metadata.lua | out | 106 | out/%.html: content/%.md .cache/meta.json .cache/assets.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/page.lua | out |
92 | $(info [MARK] $< -> $@) | 107 | $(info [MARK] $< -> $@) |
93 | 108 | ||
94 | mkdir -p $(@D) | 109 | mkdir -p $(@D) |
95 | $(eval NAMESPACE = $(call namespace,$@,.cache/meta)) | 110 | $(eval NAMESPACE = $(call namespace,$@,out)) |
96 | pandoc \ | 111 | pandoc \ |
97 | -f markdown-citations-implicit_figures \ | 112 | -f markdown-citations-implicit_figures \ |
98 | -t html5 \ | 113 | -t html5 \ |
99 | --wrap preserve \ | 114 | --wrap preserve \ |
100 | --no-highlight \ | 115 | --no-highlight \ |
101 | --template templates/base.html \ | 116 | --template templates/base.html \ |
102 | --lua-filter scripts/metadata.lua \ | 117 | --lua-filter scripts/page.lua \ |
103 | $(GLOBAL_METADATA) \ | 118 | $(GLOBAL_METADATA) \ |
104 | --metadata-file .cache/assets.json \ | 119 | --metadata-file .cache/assets.json \ |
105 | --metadata-file "$(filter .cache/meta/%.json,$^)" \ | 120 | --metadata-file .cache/meta.json \ |
106 | --metadata build.mode="$(MODE)" \ | ||
107 | --metadata build.namespace="$(NAMESPACE)" \ | 121 | --metadata build.namespace="$(NAMESPACE)" \ |
108 | --metadata build.file_out="$(patsubst out/%,/%,$@)" \ | 122 | --metadata build.file_out="$(patsubst out/%,/%,$@)" \ |
109 | $(PANDOC_FILTERS) \ | 123 | $(PANDOC_FILTERS) \ |
110 | -o "$@" "$<" | 124 | -o "$@" "$<" |
111 | 125 | ||
112 | out/%.xml: content/%.md .cache/meta/%.json $(FEED_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/metadata.lua | out | 126 | out/%.xml: content/%.md .cache/meta.json $(FEED_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/page.lua | out |
113 | $(info [FEED] $< -> $@) | 127 | $(info [FEED] $< -> $@) |
114 | 128 | ||
115 | mkdir -p $(@D) | 129 | mkdir -p $(@D) |
116 | $(eval NAMESPACE = $(call namespace,$@,.cache/meta)) | 130 | $(eval NAMESPACE = $(call namespace,$@,out)) |
117 | pandoc \ | 131 | pandoc \ |
118 | -f markdown-citations-implicit_figures \ | 132 | -f markdown-citations-implicit_figures \ |
119 | -t html5 \ | 133 | -t html5 \ |
120 | --wrap preserve \ | 134 | --wrap preserve \ |
121 | --no-highlight \ | 135 | --no-highlight \ |
122 | --template templates/feed.xml \ | 136 | --template templates/feed.xml \ |
123 | --lua-filter scripts/metadata.lua \ | 137 | --lua-filter scripts/page.lua \ |
124 | $(GLOBAL_METADATA) \ | 138 | $(GLOBAL_METADATA) \ |
125 | --metadata-file "$(filter .cache/meta/%.json,$^)" \ | 139 | --metadata-file .cache/meta.json \ |
126 | --metadata build.mode="$(MODE)" \ | ||
127 | --metadata build.namespace="$(NAMESPACE)" \ | 140 | --metadata build.namespace="$(NAMESPACE)" \ |
128 | --metadata build.file_out="$(patsubst out/%,/%,$@)" \ | 141 | --metadata build.file_out="$(patsubst out/%,/%,$@)" \ |
129 | $(PANDOC_FILTERS) \ | 142 | $(PANDOC_FILTERS) \ |