From 9fdc163fc52e2ad347c3f72675368ff03fe40e98 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Sat, 8 May 2021 10:33:02 +0200 Subject: [PATCH] fix index script --- Makefile | 16 +++++++++++----- engine/mk-index.sh | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d1e7a07..a737719 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # From https://github.com/fcanas/bake/blob/master/Makefile # Finally https://www.arsouyes.org/blog/2017/10_Static_website/ -all: fast +all: site SRC_DIR ?= src DST_DIR ?= _site CACHE_DIR ?= .cache @@ -44,17 +44,19 @@ $(DST_DIR)/%.html: $(SRC_DIR)/%.org $(TEMPLATE) minify --mime text/html $@.tmp > $@ @rm $@.tmp ALL += $(DST_PANDOC_FILES) - +html: $(DST_PANDOC_FILES) # HTML INDEX HTML_INDEX := $(DST_DIR)/index.html MKINDEX := engine/mk-index.sh -$(HTML_INDEX): $(DST_PANDOC_FILES) $(MKINDEX) +$(HTML_INDEX): $(DST_PANDOC_FILES) $(MKINDEX) $(TEMPLATE) @mkdir -p $(DST_DIR) $(MKINDEX) ALL += $(HTML_INDEX) +index: $(HTML_INDEX) + # RSS SRC_POSTS_DIR ?= $(SRC_DIR)/posts DST_POSTS_DIR ?= $(DST_DIR)/posts @@ -89,6 +91,7 @@ $(DST_DIR)/%.gmi: $(SRC_DIR)/%.org $(GMI) engine/org2gemini_step1.sh @mkdir -p $(dir $@) $(GMI) "$<" "$@" ALL += $(DST_GMI_FILES) +gmi: $(DST_GMI_FILES) # GEMINI INDEX GMI_INDEX := $(DST_DIR)/index.gmi @@ -97,6 +100,7 @@ $(GMI_INDEX): $(DST_GMI_FILES) $(MK_GMI_INDEX) @mkdir -p $(DST_DIR) $(MK_GMI_INDEX) ALL += $(GMI_INDEX) +gmi-index: $(GMI_INDEX) # RSS GEM_ATOM := $(DST_DIR)/gem-atom.xml @@ -104,6 +108,7 @@ MK_GEMINI_ATOM := engine/mk-gemini-atom.sh $(GEM_ATOM): $(DST_GMI_FILES) $(MK_GEMINI_ATOM) $(MK_GEMINI_ATOM) ALL += $(GEM_ATOM) +gmi-atom: $(GMI_ATOM) gemini: $(DST_GMI_FILES) $(GMI_INDEX) $(GEM_ATOM) @@ -128,14 +133,15 @@ $(DST_DIR)/%.png: $(SRC_DIR)/%.png convert "$<" -quality 50 -resize 800x800\> "$@" ALL += $(DST_IMG_FILES) +img: $(DST_IMG_FILES) + # DEPLOY +site: $(ALL) deploy: $(ALL) engine/sync.sh # deploy to her.esy.fun engine/ye-com-fastpublish.hs # deploy to yannesposito.com (via github pages) -fast: $(ALL) - .PHONY: clean clean: diff --git a/engine/mk-index.sh b/engine/mk-index.sh index 84faab1..47100c7 100755 --- a/engine/mk-index.sh +++ b/engine/mk-index.sh @@ -134,7 +134,7 @@ body=$(< $tmpdir/index) date=$(LC_TIME=en_US date +'%Y-%m-%d') # the pandoc templates use $x$ format, we replace it by just $x # to be used with envsubst -template=$(< templates/post.html | perl -pe 's#(\$[^\$]*)\$#$1#g' ) +template=$(< templates/post.html | sed 's/\$header-includes\$//' | perl -pe 's#(\$[^\$]*)\$#$1#g' ) { export title export author