summaryrefslogtreecommitdiff
path: root/Makefile
blob: f7acbd1989025b0f8689b3e0257a99aaeae6c7fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Written for FreeBSD make(1), or pmake. Not tested with GNU make.

EDITOR = $$EDITOR
POST_T = templates/template.html

.PHONY: serve post 

serve: 
	python3.7 -m http.server 3000

post: 
	@read -p "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; \
	sed -i '' "s/{{ title }}/$$TITLE/g" $$FILENAME; \
	$$EDITOR $$FILENAME