From 2c2e491fc65d159d57de6121776b2b0424588a29 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Sat, 31 Jul 2021 09:21:04 -0400 Subject: [PATCH] reorganized templates --- README.md | 4 --- build/stylesheets/root.css | 16 +++++++++ pinopress | 34 ++++++++----------- templates/archivebody.template.html | 3 -- ...emplate.html => archivepage.template.html} | 12 +++++-- templates/articlepage.template.html | 21 ++++++++++++ templates/feed.template.xml | 2 +- templates/foot.template.html | 4 --- templates/rollingbody.template.html | 4 --- templates/rollingpage.template.html | 19 +++++++++++ 10 files changed, 82 insertions(+), 37 deletions(-) delete mode 100644 templates/archivebody.template.html rename templates/{head.template.html => archivepage.template.html} (60%) create mode 100644 templates/articlepage.template.html delete mode 100644 templates/foot.template.html delete mode 100644 templates/rollingbody.template.html create mode 100644 templates/rollingpage.template.html diff --git a/README.md b/README.md index 5b725d6..7ed0e9b 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,3 @@ pinopress articles are written in an enhanced version of markdown. specification `$USERLOCAL2` - another user local variable -## mounts - -many times, you would like to display a list of html elements somewhere in the page. **pinopress** solves this using mounts. mounts are simply comments that tell pinopress where to append template items. - diff --git a/build/stylesheets/root.css b/build/stylesheets/root.css index 67f9a26..18ad2b0 100644 --- a/build/stylesheets/root.css +++ b/build/stylesheets/root.css @@ -69,3 +69,19 @@ a:hover { strong { color: var(--text-light); } + +pre { + + background-color: var(--bg-light); + + padding: 0.75rem; + + /* border: 1px solid var(--text-light); */ + /* border-radius: 0.5rem; */ +} + +code { + color: var(--text-light); + background-color: var(--bg-light); +} + diff --git a/pinopress b/pinopress index b47d785..58b826a 100755 --- a/pinopress +++ b/pinopress @@ -33,7 +33,7 @@ endef define loop_article for article_file in `ls $(SRC_DIR)`; do . ./$(MODULE_DIR)/md-header "$(SRC_DIR)/$$article_file" - envsubst < $(TEMPLATE_DIR)/$(2) | sed -i "//r /dev/stdin" "$(1)" + envsubst < $(TEMPLATE_DIR)/$(2) | sed -i "//r /dev/stdin" "$(1)" done endef @@ -42,42 +42,38 @@ help: build: $(BUILD_DIR)/rolling.html $(BUILD_DIR)/archive.html $(BUILD_DIR)/feed.xml $(addprefix $(BUILD_DIR)/$(ARTICLE_PATH)/,$(addsuffix .html,$(ARTICLE_LIST))) -.ONESHELL: -$(BUILD_DIR)/rolling.html: - echo 'building rolling file' +# usage: build_page [page_template] [item_template] [display_message] +define build_page + echo "$(3)" $(export_common) - cat $(TEMPLATE_DIR)/head.template.html $(TEMPLATE_DIR)/rollingbody.template.html $(TEMPLATE_DIR)/foot.template.html > "$@" - $(call loop_article,"$@",rollingitem.template.html) + cat $(TEMPLATE_DIR)/$(1) > "$@" + $(call loop_article,"$@",$(2)) envsubst < "$@" | sponge "$@" +endef + +.ONESHELL: +$(BUILD_DIR)/rolling.html: + $(call build_page,rollingpage.template.html,rollingitem.template.html,building rolling file) .ONESHELL: $(BUILD_DIR)/archive.html: - echo 'building archive file' - $(export_common) - cat $(TEMPLATE_DIR)/head.template.html $(TEMPLATE_DIR)/archivebody.template.html $(TEMPLATE_DIR)/foot.template.html > "$@" - $(call loop_article,"$@",archiveitem.template.html) - envsubst < "$@" | sponge "$@" + $(call build_page,archivepage.template.html,archiveitem.template.html,building archive file) .ONESHELL: $(BUILD_DIR)/feed.xml: - echo 'building feed file' - $(export_common) - cat $(TEMPLATE_DIR)/feed.template.xml > "$@" - $(call loop_article,"$@",feeditem.template.xml) - envsubst < "$@" | sponge "$@" + $(call build_page,feed.template.xml,feeditem.template.xml,building feed file) .ONESHELL: $(BUILD_DIR)/$(ARTICLE_PATH)/%.html: $(SRC_DIR)/%.md echo "parsing $<" $(export_common) $(call export_article,"$<") - cat $(TEMPLATE_DIR)/head.template.html > "$@" + cat $(TEMPLATE_DIR)/articlepage.template.html > "$@" # module pipeline starts here - ./$(MODULE_DIR)/md "$<" >> "$@" + ./$(MODULE_DIR)/md "$<" | sed -i "//r /dev/stdin" "$@" . ./$(MODULE_DIR)/md-header "$<" . ./$(MODULE_DIR)/readingtime "$<" # module pipeline ends here - cat $(TEMPLATE_DIR)/foot.template.html >> "$@" envsubst < "$@" | sponge "$@" clean: diff --git a/templates/archivebody.template.html b/templates/archivebody.template.html deleted file mode 100644 index c7c6bef..0000000 --- a/templates/archivebody.template.html +++ /dev/null @@ -1,3 +0,0 @@ -

Archive

- - diff --git a/templates/head.template.html b/templates/archivepage.template.html similarity index 60% rename from templates/head.template.html rename to templates/archivepage.template.html index ee53597..2dc1b7f 100644 --- a/templates/head.template.html +++ b/templates/archivepage.template.html @@ -2,10 +2,18 @@ - - + Archive + +

Archive

+ + + + + + diff --git a/templates/articlepage.template.html b/templates/articlepage.template.html new file mode 100644 index 0000000..e0d94db --- /dev/null +++ b/templates/articlepage.template.html @@ -0,0 +1,21 @@ + + + + + + $ARTICLE_TITLE + + + + + +
+ + + +
+ + + + diff --git a/templates/feed.template.xml b/templates/feed.template.xml index 30759b4..80d5e47 100644 --- a/templates/feed.template.xml +++ b/templates/feed.template.xml @@ -6,7 +6,7 @@ $SITEURL - + diff --git a/templates/foot.template.html b/templates/foot.template.html deleted file mode 100644 index 7320ede..0000000 --- a/templates/foot.template.html +++ /dev/null @@ -1,4 +0,0 @@ - - - diff --git a/templates/rollingbody.template.html b/templates/rollingbody.template.html deleted file mode 100644 index fd68895..0000000 --- a/templates/rollingbody.template.html +++ /dev/null @@ -1,4 +0,0 @@ -

Rolling

- - - diff --git a/templates/rollingpage.template.html b/templates/rollingpage.template.html new file mode 100644 index 0000000..e953cca --- /dev/null +++ b/templates/rollingpage.template.html @@ -0,0 +1,19 @@ + + + + + + Rolling + + + + + +

Rolling

+ + + + + + -- 2.20.1