diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -1,27 +1,24 @@ # Written for FreeBSD make(1), or pmake. Not tested with GNU make. TEMPLATE = templates/template.html -RSS_TEMPLATE = templates/rss.xml -.PHONY: all clean serve post +.PHONY: serve post -serve: all +serve: python3.7 -m http.server 3000 -clean: - rm -f index.html - rm -f rss.xml - profile/adamcarpenter.pdf: profile/adamcarpenter.html touch profile/adamcarpenter.pdf -post: clean +post: @read -p "Title: " TITLE; \ read -p "Category: " CATEGORY; \ SHORT_DATE=`date +"%Y-%m-%d"`; \ - LONG_DATE=`date -R`; \ + LONG_DATE=`date +"%a, %d %b %Y"`; \ mkdir -p posts/$$CATEGORY; \ - FILENAME=posts/$$CATEGORY/`date +"%Y-%m-%d-"``echo $$TITLE | tr "[:upper:]" "[:lower:]" | tr "[:blank:]" -`.html; \ + FILENAME=posts/$$CATEGORY/$$SHORT_DATE-`echo $$TITLE | tr "[:upper:]" "[:lower:]" | tr "[:blank:]" -`.html; \ cp $(TEMPLATE) $$FILENAME; \ $$EDITOR $$FILENAME; \ + sed -i '' "s#</channel> </rss>#<item> <title>$$TITLE</title> <pubDate>$$LONG_DATE</pubDate> <link>https://www.53hor.net/$$FILENAME</link> <guid>https://www.53hor.net/$$FILENAME</guid> </item>\n</channel> </rss>#" rss.xml; \ + sed -i '' "s#<ul id=\"index\">#<ul id=\"index\">\n<li> <a href=\"/$$FILENAME\">$$TITLE <code>$$LONG_DATE</code> </a> </li>#" index.html |