summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile33
1 files changed, 21 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index e985d34..784bcac 100644
--- a/Makefile
+++ b/Makefile
@@ -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