Browse Source

:tada: Create first grouped metadata

Rely on [yq](https://mikefarah.gitbook.io/yq/commands/evaluate-all)
DricomDragon 1 year ago
parent
commit
37746ec60c
1 changed files with 13 additions and 0 deletions
  1. 13 0
      makefile

+ 13 - 0
makefile

@@ -10,6 +10,8 @@ GEN_HTMLS := $(SRC_HTMLS:%.src.html=%.gen.html)
 GEN_MDS := $(SRC_MDS:%.src.md=%.gen.html)
 GEN_FILES := $(GEN_HTMLS) $(GEN_MDS)
 
+LISTED_META_FILES := $(shell echo src/projets/*/*.meta.yml)
+
 INCLUDED_FILES := $(shell find src/include -type f)
 EMBEDDED_FILES := $(shell find src -name '*.png' -or -name '*.svg' -or -name '*.pdf')
 
@@ -19,7 +21,9 @@ DIST_EMB_FILES := $(EMBEDDED_FILES:src/%=$(DIST_DIR)/%)
 DIST_FILES := $(DIST_GEN_FILES) $(DIST_INC_FILES) $(DIST_DWN_FILES) $(DIST_EMB_FILES) $(DIST_DIR)/favicon.ico
 
 PANDOC_GEN := pandoc --standalone --wrap=none --template src/templates/main.html --metadata-file src/meta.yml
+LIST_GEN := yq eval-all '. as $item ireduce ([]; . + $item )'
 
+# Build
 .PHONY: build
 build: $(GEN_FILES)
 	$(info HTML generated)
@@ -30,6 +34,14 @@ build: $(GEN_FILES)
 %.gen.html: %.src.md %.meta.yml $(SRC_TEMPLATES)
 	$(PANDOC_GEN) --metadata-file $*.meta.yml --output $@ $<
 
+# Build lists
+src/projets/list.meta.yml: $(LISTED_META_FILES)
+	$(LIST_GEN) $(LISTED_META_FILES) > $@
+
+src/projets/content.gen.html: src/projets/content.src.html src/projets/content.meta.yml src/projets/list.meta.yml
+	$(PANDOC_GEN) --metadata-file src/projets/content.meta.yml --metadata-file src/projets/list.meta.yml --output $@ $<
+
+# Distribution
 .PHONY: dist
 dist: $(DIST_DIR)
 	$(info Distributed folder generated)
@@ -44,6 +56,7 @@ $(DIST_DIR)/%: src/%
 	mkdir --parents $(dir $@)
 	cp $< $@
 
+# Cleaning
 .PHONY: clean
 clean:
 	rm -f $(GEN_FILES)