summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-21 05:16:47 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-21 05:16:47 +0300
commit80b0b83d7d64fe4468edb81e8fb970475c8f9efe (patch)
tree6a20b6bed079b370c6772cd4e04c38c9b351fc4c
parentb573c1e4e5f61c6fd1c96985d73da4861cbbe728 (diff)
downloadbenzin-80b0b83d7d64fe4468edb81e8fb970475c8f9efe.tar.gz
feat: add RSS generation
-rw-r--r--Makefile33
1 files changed, 28 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index dc27999..37b1b16 100644
--- a/Makefile
+++ b/Makefile
@@ -2,23 +2,46 @@
HEADER=templates/header.html
PANDOC_ARGS=--from=gfm+emoji --to=html --section-divs
+RSS=out/blog/index.xml
+
+BLOG_SOURCES=$(wildcard src/blog/*.md)
+SOURCES=$(wildcard src/*.md) $(BLOG_SOURCES)
-SOURCES=$(wildcard src/*.md src/**/*.md)
TMP_HTML=$(patsubst src/%.md, tmp/%.content.html, $(SOURCES))
HTML=$(patsubst src/%.md, out/%.html, $(SOURCES))
+BLOG_XML=$(patsubst src/%.md, tmp/%.xml, $(BLOG_SOURCES))
+
.PHONY: clean all
.SECONDARY: $(TMP_HTML)
-all: $(HTML)
+all: $(HTML) $(RSS)
out/%.html: $(HEADER) tmp/%.content.html
- mkdir -p $(@D)
+ @mkdir -p $(@D)
cat $^ > $@
tmp/%.content.html: src/%.md
- mkdir -p $(@D)
- cat $< | pandoc $(PANDOC_ARGS) > $@
+ @mkdir -p $(@D)
+ pandoc $(PANDOC_ARGS) $< > $@
+
+$(RSS): $(BLOG_XML)
+ @echo $@
+ @echo '<rss version="2.0"><channel>' > $@
+ @echo "<title>TODO</title><link>TODO</link><description>TODO</description>" >> $@
+ @echo "<lastBuildDate>$$(date --rfc-email)</lastBuildDate>" >> $@
+ cat $^ >> $@
+ @echo '</channel></rss>' >> $@
+
+tmp/%.xml: tmp/%.content.html
+ @echo '<item>' > $@
+ @echo " <link>TODO</link>" >> $@
+ @echo " <pubDate>TODO</pubDate>" >> $@
+ @echo " <title>TODO</title>" >> $@
+ @echo " <description><![CDATA[" >> $@
+ cat $< >> $@
+ @echo " ]]></description>" >> $@
+ @echo '</item>' >> $@
clean:
rm -rf tmp out