diff --git a/patrick-markdown/Makefile b/patrick-markdown/Makefile
index d21323a..7d46cc4 100644
--- a/patrick-markdown/Makefile
+++ b/patrick-markdown/Makefile
@@ -1,5 +1,9 @@
SHELL := /bin/bash
+# CSS to be included as stylesheets and alternate stylesheets
+CSS := assets/ghost.css
+ALTCSS := assets/ghost-dark.css assets/ghost-caca.css
+
TARGETS := $(patsubst %.md,%.html,$(wildcard *.md))
CSSINC := assets/css.inc
@@ -7,20 +11,16 @@ CSSINC := assets/css.inc
# https://github.com/jgm/pandoc-templates/blob/master/default.html5
TEMPLATE := assets/pandoc-template.html5
-# CSS to be included as stylesheets and alternate stylesheets
-CSS := assets/ghost.css
-ALTCSS := assets/ghost-dark.css assets/ghost-caca.css
+define ADD_LINE
+printf '\n' "$(2)" "$(1)" "$(notdir $(basename $(1)))" >> $(3);
+endef
-OPTS := --standalone --include-in-header=$(CSSINC) --template=$(TEMPLATE) \
- --metadata=title:"$(call TIT,$<)" --from=gfm --to=html5
-
-# To provide a title to pandoc. We take the first line starting with '#',
+# provide a title to pandoc. We take the first line starting with '#',
# and remove initial '#' and spaces
TITLE = $(shell sed -n '0,/^#/ s/^[# ]*//p' $1)
-define ADD_LINE
-printf '\n' "$(2)" "$(1)" >> $(3);
-endef
+OPTS = --standalone --include-in-header=$(CSSINC) --template=$(TEMPLATE) \
+ --from=gfm --to=html5
.PHONY: all html clean $(CSSINC)
@@ -32,12 +32,12 @@ clean:
@echo cleaning $(TARGETS) $(CSSINC)
@rm -f $(TARGETS) $(CSSINC)
-$(CSSINC): $(_CSS) $(_ALTCSS)
+$(CSSINC): $(CSS) $(ALTCSS)
@echo generating $@
- @rm -f $@
- @$(foreach css,$(_CSS),$(call ADD_LINE,$(css),stylesheet,$@))
- @$(foreach css,$(_ALTCSS),$(call ADD_LINE,$(css),alternate stylesheet,$@))
+ rm -f $@
+ $(foreach css,$(CSS),$(call ADD_LINE,$(css),stylesheet,$@))
+ $(foreach css,$(ALTCSS),$(call ADD_LINE,$(css),alternate stylesheet,$@))
-%.html: %.md $(_CSS)
+%.html: %.md $(CSSINC)
@echo generating $@
- @pandoc $(PANDOCOPTS) -o $@ $<
+ pandoc $(OPTS) --metadata=title:"$(call TITLE,$<)" -o $@ $<
diff --git a/patrick-markdown/assets/pandoc-template.html5 b/patrick-markdown/assets/pandoc-template.html5
index d3a247a..c8ec25c 100644
--- a/patrick-markdown/assets/pandoc-template.html5
+++ b/patrick-markdown/assets/pandoc-template.html5
@@ -36,7 +36,6 @@ $include-before$
$endfor$
$if(title)$