summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 6 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index 3f7c13c..8dcd6e5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,35 +1,17 @@
# Written for FreeBSD make(1), or pmake. Not tested with GNU make.
EDITOR = $$EDITOR
-POST_T = templates/template.html
-INDEX_HEAD_T = templates/index_head.html
-INDEX_FOOT_T = templates/index_foot.html
-RSS_HEAD_T = templates/rss_head.xml
-RSS_FOOT_T = templates/rss_foot.xml
+POST_T = includes/template.php
-all: index.html rss.xml cv.pdf
-
-index.html: posts/*.html
- @grep h1 $> | sort -r | sed 's#^\(posts/\([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\)[^:]*\):[ \t]*<h1>\(.*\)</h1>#<li><a href="/\1">\3 <code>\2</code></a></li>#' | cat $(INDEX_HEAD_T) - $(INDEX_FOOT_T) > index.html
-
-rss.xml: posts/*.html
- @grep h1 $> | sort -r | sed 's#^\(posts/[^:]*\):[ \t]*<h1>\(.*\)</h1>#<item><title>\2</title><link>https://www.53hor.net/posts/\1</link></item>#' | cat $(RSS_HEAD_T) - $(RSS_FOOT_T) > rss.xml
-
-cv.pdf: cv.html
- @mutool convert -o cv.pdf cv.html
-
-.PHONY: serve post clean
+.PHONY: serve post
serve:
- python3.7 -m http.server 3000
+ php -S localhost:8000
-post:
- @read -p "Title: " TITLE; \
+draft:
+ @read -rp "Title: " TITLE; \
SHORT_DATE=`date +"%Y-%m-%d"`; \
- FILENAME=posts/$$SHORT_DATE-`printf "$$TITLE" | tr -Cs "[:alnum:]" '-' | tr "[:upper:]" "[:lower:]"`.html; \
- cp $(POST_T) $$FILENAME; \
+ FILENAME=drafts/$$SHORT_DATE-`printf "$$TITLE" | tr -Cs "[:alnum:]" '-' | tr "[:upper:]" "[:lower:]"`.php; \
sed -i '' "s/{{ title }}/$$TITLE/g" $$FILENAME; \
$$EDITOR $$FILENAME
-clean:
- rm -f index.html rss.xml