summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-21 16:06:49 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-21 16:06:49 +0300
commit3d1a2ee24442f9fe2078a60526eeb913fc59e12a (patch)
treeb05d499b31e53c2af8c8bb6a27db5da08bee53ec
parent53743b48b65ecf43b43ea4924b26bbfd80c39ecb (diff)
downloadbenzin-3d1a2ee24442f9fe2078a60526eeb913fc59e12a.tar.gz
feat: add serve target
-rw-r--r--Makefile18
1 files changed, 13 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 8712bf6..0aada0c 100644
--- a/Makefile
+++ b/Makefile
@@ -2,13 +2,14 @@
BASE_URL=https://example.com
-CONVERT=pandoc --from=gfm+emoji --to=html --section-divs
+CONVERT=pandoc --from=gfm+emoji --to=html --section-divs --shift-heading-level-by=1
PAGE_TEMPLATE=templates/page.html
OPENRING_TEMPLATE=templates/openring.html
RSS_TEMPLATE=templates/rss.xml
RSS_ITEM_TEMPLATE=templates/rss_item.xml
RSS=out/blog/index.xml
+PUBLIC=out/public
OPENRING_FOOTER=tmp/openring.html
OPENRING_ARGS=-s https://eug-vs.xyz/blog/index.xml -s https://drewdevault.com/blog/index.xml
@@ -21,10 +22,10 @@ HTML=$(patsubst src/%.md, out/%.html, $(SOURCES))
BLOG_XML=$(patsubst src/%.md, tmp/%.xml, $(BLOG_SOURCES))
-.PHONY: clean all
+.PHONY: clean all serve
.SECONDARY: $(TMP_HTML) $(BLOG_XML)
-all: $(HTML) $(RSS)
+all: $(HTML) $(RSS) $(PUBLIC)
out/%.html: tmp/%.content.html tmp/%.meta.title $(PAGE_TEMPLATE) $(OPENRING_FOOTER)
@mkdir -p $(@D)
@@ -36,7 +37,7 @@ out/%.html: tmp/%.content.html tmp/%.meta.title $(PAGE_TEMPLATE) $(OPENRING_FOOT
tmp/%.content.html: src/%.md
@mkdir -p $(@D)
- $(CONVERT) $< > $@
+ sed "s/.md)/.html)/g" $< | $(CONVERT) > $@
tmp/%.meta.title: src/%.md
@mkdir -p $(@D)
@@ -59,5 +60,12 @@ $(OPENRING_FOOTER): $(OPENRING_TEMPLATE)
@mkdir -p $(@D)
openring $(OPENRING_ARGS) < $< > $@
+# TODO: this is dumb
+$(PUBLIC): src/public
+ cp -r $< $@
+
+serve: $(HTML)
+ quark -h 127.0.0.1 -p 8000 -d out -l
+
clean:
- rm -rf tmp out
+ rm -rf tmp out/*