basic building
authorDaniel Liu <mr.picklepinosaur@gmail.com>
Mon, 12 Jul 2021 01:26:29 +0000 (21:26 -0400)
committerDaniel Liu <mr.picklepinosaur@gmail.com>
Mon, 12 Jul 2021 01:26:29 +0000 (21:26 -0400)
modules/md
pinopress
templates/archivebody.template.html [new file with mode: 0644]
templates/foot.template.html
templates/head.template.html
templates/rollingbody.template.html [new file with mode: 0644]

index 5dbcc41..717e395 100755 (executable)
@@ -4,10 +4,11 @@
 ## based off https://github.com/stamby/md-to-html
 # input $1 - filepath to html file
 
 ## based off https://github.com/stamby/md-to-html
 # input $1 - filepath to html file
 
-# parse header of document
+# remove document meta
+/^-- \w+: .+$/d
 
 # html style comments
 
 # html style comments
-s/<!--(.*)-->//g
+/<!--(.*)-->/d
 
 # special html characters
 s/\&/\&amp\;/g
 
 # special html characters
 s/\&/\&amp\;/g
index d056dab..c31657c 100755 (executable)
--- a/pinopress
+++ b/pinopress
@@ -1,4 +1,4 @@
-#!/usr/bin/make -f
+#!/usr/bin/make -sf
 
 SITEURL := https://blog.danieliu.xyz
 
 
 SITEURL := https://blog.danieliu.xyz
 
@@ -7,15 +7,36 @@ SITEURL := https://blog.danieliu.xyz
 # internal variables
 TEMPLATE_DIR := templates
 BUILD_DIR := build
 # 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:
 
 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:
 
 clean:
-       @echo 'cleaning...'
+       echo 'cleaning...'
+       rm $(BUILD_DIR)/rolling.html $(BUILD_DIR)/archive.html $(ARTICLE_PATH)/*
+
diff --git a/templates/archivebody.template.html b/templates/archivebody.template.html
new file mode 100644 (file)
index 0000000..200d0cc
--- /dev/null
@@ -0,0 +1 @@
+<h1>Archive</h1>
index 5e0ea02..7320ede 100644 (file)
@@ -1,2 +1,4 @@
+</body>
 <footer>
 </footer>
 <footer>
 </footer>
+</html>
index 81d7289..a4fc487 100644 (file)
@@ -1,6 +1,9 @@
+<!DOCTYPE html>
+<html>
 <head>
     <meta charset="utf-8">
     <link rel="stylesheet" href="#"> 
     <link rel="shortcut icon" href="#">
     <title></title>
 </head>
 <head>
     <meta charset="utf-8">
     <link rel="stylesheet" href="#"> 
     <link rel="shortcut icon" href="#">
     <title></title>
 </head>
+<body>
diff --git a/templates/rollingbody.template.html b/templates/rollingbody.template.html
new file mode 100644 (file)
index 0000000..2123bde
--- /dev/null
@@ -0,0 +1 @@
+<h1>Rolling</h1>