diff --git a/patrick-markdown/.gitignore b/patrick-markdown/.gitignore new file mode 100644 index 0000000..5b9f662 --- /dev/null +++ b/patrick-markdown/.gitignore @@ -0,0 +1,2 @@ +/*.html +/assets/css.inc \ No newline at end of file diff --git a/patrick-markdown/Makefile b/patrick-markdown/Makefile new file mode 100644 index 0000000..d21323a --- /dev/null +++ b/patrick-markdown/Makefile @@ -0,0 +1,43 @@ +SHELL := /bin/bash + +TARGETS := $(patsubst %.md,%.html,$(wildcard *.md)) +CSSINC := assets/css.inc + +# our main html5 template, mostly taken from : +# 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 + +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 '#', +# and remove initial '#' and spaces +TITLE = $(shell sed -n '0,/^#/ s/^[# ]*//p' $1) + +define ADD_LINE +printf '\n' "$(2)" "$(1)" >> $(3); +endef + +.PHONY: all html clean $(CSSINC) + +all: $(CSSINC) html + +html: $(TARGETS) + +clean: + @echo cleaning $(TARGETS) $(CSSINC) + @rm -f $(TARGETS) $(CSSINC) + +$(CSSINC): $(_CSS) $(_ALTCSS) + @echo generating $@ + @rm -f $@ + @$(foreach css,$(_CSS),$(call ADD_LINE,$(css),stylesheet,$@)) + @$(foreach css,$(_ALTCSS),$(call ADD_LINE,$(css),alternate stylesheet,$@)) + +%.html: %.md $(_CSS) + @echo generating $@ + @pandoc $(PANDOCOPTS) -o $@ $< diff --git a/patrick-markdown/assets/ghost-caca.css b/patrick-markdown/assets/ghost-caca.css new file mode 100644 index 0000000..a8a248e --- /dev/null +++ b/patrick-markdown/assets/ghost-caca.css @@ -0,0 +1,24 @@ +@font-face { + font-family: 'Open Sans Regular'; + src: url('OpenSans-Regular.ttf')format('truetype'); +} + +body { + background-color: #500303; + color: #f2f2f2; + width: 34%; + margin: 40px 33% 10px 33%; + font-family: 'Open Sans Regular', sans-serif ; +} + +code { + font-size: 1.1em; +} + +pre { + outline: 1px solid; + border-radius: 3px; + padding: 5px; + background-color: #080808; + color: eeeeee: +} diff --git a/patrick-markdown/assets/ghost-dark.css b/patrick-markdown/assets/ghost-dark.css new file mode 100644 index 0000000..4f5102c --- /dev/null +++ b/patrick-markdown/assets/ghost-dark.css @@ -0,0 +1,24 @@ +@font-face { + font-family: 'Open Sans Regular'; + src: url('OpenSans-Regular.ttf')format('truetype'); +} + +body { + background-color: #050505; + color: #f2f2f2; + width: 34%; + margin: 40px 33% 10px 33%; + font-family: 'Open Sans Regular', sans-serif ; +} + +code { + font-size: 1.1em; +} + +pre { + outline: 1px solid; + border-radius: 3px; + padding: 5px; + background-color: #080808; + color: eeeeee: +} diff --git a/patrick-markdown/assets/ghost.css b/patrick-markdown/assets/ghost.css new file mode 100644 index 0000000..092a476 --- /dev/null +++ b/patrick-markdown/assets/ghost.css @@ -0,0 +1,21 @@ +@font-face { + font-family: 'Open Sans Regular'; + src: url('OpenSans-Regular.ttf')format('truetype'); +} + +body { + width: 34%; + margin: 40px 33% 10px 33%; + font-family: 'Open Sans Regular', sans-serif ; +} + +code { + font-size: 1.1em; +} + +pre { + outline: 1px solid; + border-radius: 3px; + padding: 5px; + background-color: #f2f2f2; +} diff --git a/patrick-markdown/assets/pandoc-template.html5 b/patrick-markdown/assets/pandoc-template.html5 new file mode 100644 index 0000000..d3a247a --- /dev/null +++ b/patrick-markdown/assets/pandoc-template.html5 @@ -0,0 +1,70 @@ + + +
+ + + +$for(author-meta)$ + +$endfor$ +$if(date-meta)$ + +$endif$ +$if(keywords)$ + +$endif$ +$if(description-meta)$ + +$endif$ +$subtitle$
+$endif$ +$for(author)$ + +$endfor$ +$if(date)$ +$date$
+$endif$ +$if(abstract)$ +