X-Git-Url: https://git.danieliu.xyz/?p=pinopress.git;a=blobdiff_plain;f=pinopress;fp=pinopress;h=c31657cd91809cc386de1d4ab18325659d612c09;hp=d056dabf31d4c9446b462ff925e2f778846813ae;hb=65d70f73b4e67c4c5768a15bb85d1dcfb1a66351;hpb=8f843459581548b8a806a5ab8178efc4c7cfdd89 diff --git a/pinopress b/pinopress index d056dab..c31657c 100755 --- a/pinopress +++ b/pinopress @@ -1,4 +1,4 @@ -#!/usr/bin/make -f +#!/usr/bin/make -sf SITEURL := https://blog.danieliu.xyz @@ -7,15 +7,36 @@ SITEURL := https://blog.danieliu.xyz # internal variables TEMPLATE_DIR := templates BUILD_DIR := build -ARTICLE_DIR := articles +SRC_DIR := articles +MODULE_DIR := modules -ARTICLE_LIST := $(basename $(shell ls $(ARTICLE_DIR))) +ARTICLE_PATH := $(BUILD_DIR)/article + +ARTICLE_LIST := $(basename $(shell ls $(SRC_DIR))) help: - @echo 'pinopress help|build|clean' + echo 'pinopress help|build|clean' + +build: $(BUILD_DIR)/rolling.html $(BUILD_DIR)/archive.html $(ARTICLE_PATH)/$(addsuffix .html,$(ARTICLE_LIST)) + echo 'building...' + +$(BUILD_DIR)/rolling.html: + echo 'building rolling file' + cat $(TEMPLATE_DIR)/head.template.html $(TEMPLATE_DIR)/rollingbody.template.html $(TEMPLATE_DIR)/foot.template.html > "$@" -build: - @echo 'building...' +$(BUILD_DIR)/archive.html: + echo 'building archive file' + cat $(TEMPLATE_DIR)/head.template.html $(TEMPLATE_DIR)/archivebody.template.html $(TEMPLATE_DIR)/foot.template.html > "$@" + +$(ARTICLE_PATH)/%.html: articles/%.md + echo 'parsing $^' + cat $(TEMPLATE_DIR)/head.template.html > "$@" + # module pipeline starts here + ./$(MODULE_DIR)/md "$^" >> "$@" + # module pipeline ends here + cat $(TEMPLATE_DIR)/foot.template.html >> "$@" clean: - @echo 'cleaning...' + echo 'cleaning...' + rm $(BUILD_DIR)/rolling.html $(BUILD_DIR)/archive.html $(ARTICLE_PATH)/* +