Created
December 16, 2016 13:33
-
-
Save npryce/af179f01f48272c9bfe6351af513bd64 to your computer and use it in GitHub Desktop.
Pandoc Makefile example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MARKDOWN_SRC:=$(shell find doc -name '*.md') | |
DIAGRAM_SRC:=$(shell find doc -name '*.plantuml') | |
MARKDOWN_FORMAT=markdown+fenced_code_blocks+fenced_code_attributes+grid_tables+footnotes | |
# Order is significant when multiple CSS files | |
CSS_SRC:=styles/style.css | |
SITE_HTML=$(MARKDOWN_SRC:doc/%.md=out/site/%.html) $(DIAGRAM_SRC:doc/%.plantuml=out/site/%.png) | |
SITE_CSS=$(CSS_SRC:styles/%=out/site/%) | |
all: $(SITE_HTML) $(SITE_CSS) | |
VPATH=doc:styles:out/tmp | |
out/site/%.html: %.md | |
@mkdir -p $(dir $@) | |
pandoc --standalone --from=$(MARKDOWN_FORMAT) --to=html \ | |
--css http://fonts.googleapis.com/css?family=Raleway:400,300,600 \ | |
--css $(shell echo '$(patsubst out/site/%,%,$@)' | sed -e s:[^/]::g -e s:/:../:g)style.css \ | |
$^ \ | |
| sed 's/\(<a href=".*\.\)\(md\)\(">\)/\1html\3/g' \ | |
> $@ | |
out/site/%: % | |
@mkdir -p $(dir $@) | |
cp $^ $@ | |
out/site/%.png: %.plantuml | |
@mkdir -p $(dir $@) | |
cat $< | plantuml -pipe > $@ | |
clean: | |
rm -rf .cache/ | |
rm -rf out/ | |
.PHONY: clean site | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment