diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-04-21 22:43:20 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-04-21 22:43:20 +0300 |
commit | 7f2a7db486aef55cc6d6baed69a39a715e2d93ef (patch) | |
tree | a13f6642db08df1a441f0b0155c4276964c2e05a | |
parent | 743249bed60ee78cf891577b308bbb84a2a65340 (diff) | |
download | benzin-7f2a7db486aef55cc6d6baed69a39a715e2d93ef.tar.gz |
-rw-r--r-- | Makefile | 33 |
1 files changed, 21 insertions, 12 deletions
@@ -43,6 +43,7 @@ PUBLIC=$(patsubst src/%, out/%, $(PUBLIC_SOURCES)) all: $(HTML) $(RSS) $(PUBLIC) +# Standalone HTML out/%.html: tmp/%.content.html tmp/%.meta.title tmp/%.meta.description $(PAGE_TEMPLATE) $(OPENRING_FOOTER) @mkdir -p $(@D) sed "/<\/main>/e cat $< $(OPENRING_FOOTER)" $(PAGE_TEMPLATE) > $@ @@ -52,10 +53,6 @@ out/%.html: tmp/%.content.html tmp/%.meta.title tmp/%.meta.description $(PAGE_TE -e 'a <meta name="description" content="' -e "r tmp/$*.meta.description" -e 'a "/>' \ -e '}' $@ -tmp/%.content.html: src/%.md tmp/emoji.sed - @mkdir -p $(@D) - sed -e "s/.md)/.html)/g" -f tmp/emoji.sed $< | $(CONVERT) > $@ - out/index.html: tmp/index.content.html $(PAGE_TEMPLATE) @mkdir -p $(@D) sed "/<\/main>/e cat $<" $(PAGE_TEMPLATE) > $@ @@ -64,12 +61,18 @@ out/index.html: tmp/index.content.html $(PAGE_TEMPLATE) -e "a <title>$(WEBSITE_TITLE)<\/title>" \ -e '}' $@ +# Embeddable HTML +tmp/%.content.html: src/%.md tmp/emoji.sed + @mkdir -p $(@D) + sed -e "s/.md)/.html)/g" -f tmp/emoji.sed $< | $(CONVERT) > $@ + tmp/index.content.html: src/index.md tmp/emoji.sed tmp/blog/preview.md @mkdir -p $(@D) sed -e "/$(BLOG_PREVIEW_MARKER)/r tmp/blog/preview.md" $< \ | sed -e "s/.md)/.html)/g" -f tmp/emoji.sed \ | $(CONVERT) > $@ +# Metadata (TODO: parse YAML front matter) tmp/%.meta.title: src/%.md @mkdir -p $(@D) sed '/^#/q' $< | sed 's/#* //; s/:.*://;' > $@ @@ -82,10 +85,21 @@ tmp/blog/%.meta.date: src/blog/%.md @mkdir -p $(@D) @date --rfc-email -d $* > $@ +# Emoji sed script +tmp/emoji.sed: $(EMOJI_SOURCES) + @mkdir -p $(@D) + for emoji in $^; do\ + basename=$$(basename $$emoji); \ + name=$${basename%.*}; \ + echo "s|:$${name}:|<img src=\"/public/emoji/$${basename}\" alt=\"$${name}-emoji\" height=\"$(EMOJI_SIZE)\" width=\"$(EMOJI_SIZE)\" style=\"$(EMOJI_STYLE)\">|g;" >> $@; \ + done + +# Blog preview tmp/blog/preview.md: src/blog/index.md @mkdir -p $(@D) sed -n "s/^-/ -/; s|(|(blog/| ; /^ -/p" $< | head -n 4 > $@ +# RSS $(RSS): $(BLOG_XML) $(RSS_TEMPLATE) @mkdir -p $(@D) sed "/<\/channel>/e cat $(BLOG_XML)" $(RSS_TEMPLATE) > $@ @@ -106,10 +120,12 @@ tmp/%.xml: tmp/%.content.html tmp/%.meta.title tmp/%.meta.date $(RSS_ITEM_TEMPLA -e "a <link>$(WEBSITE_URL)/$*.html<\/link>" \ -e '}' $@ +# Openring $(OPENRING_FOOTER): $(OPENRING_TEMPLATE) $(OPENRING_URLS) @mkdir -p $(@D) openring $$(sed '/^#/d; s/^/-s /' $(OPENRING_URLS)) < $< > $@ +# Assets out/public/%: src/public/% @mkdir -p $(@D) @cp $^ $@ @@ -118,14 +134,7 @@ out/public/emoji/%.png: src/public/emoji/%.png @mkdir -p $(@D) convert $< -resize $(EMOJI_SIZE)x$(EMOJI_SIZE) $@ -tmp/emoji.sed: $(EMOJI_SOURCES) - @mkdir -p $(@D) - for emoji in $^; do\ - basename=$$(basename $$emoji); \ - name=$${basename%.*}; \ - echo "s|:$${name}:|<img src=\"/public/emoji/$${basename}\" alt=\"$${name}-emoji\" height=\"$(EMOJI_SIZE)\" width=\"$(EMOJI_SIZE)\" style=\"$(EMOJI_STYLE)\">|g;" >> $@; \ - done - +# Management serve: $(HTML) quark -h 127.0.0.1 -p 8000 -d out -l |