-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
60 lines (46 loc) · 1.57 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
SOURCE_DOCS := $(wildcard *.md)
SOURCE_DOCS := $(filter-out README.md metadata.md, $(SOURCE_DOCS))
EXPORTED_DOCS=\
$(SOURCE_DOCS:.md=.html) \
$(SOURCE_DOCS:.md=.pdf) \
$(SOURCE_DOCS:.md=.docx) \
$(SOURCE_DOCS:.md=.rtf) \
$(SOURCE_DOCS:.md=.odt) \
$(SOURCE_DOCS:.md=.epub)
PANDOC_OPTIONS=-f markdown \
--table-of-contents \
--number-sections \
--pdf-engine=xelatex \
--indented-code-classes='bash,numberLines html,numberLines javascript,numberLines go,numberLines' \
--highlight-style=monochrome \
-V mainfont="Palatino" \
-V fontsize="10pt" \
-V documentclass=report \
-V papersize=A5 \
-V linestretch='0.85' \
-V geometry:margin=0.5in \
-V links-as-notes=true \
--metadata-file=metadata.md
PANDOC_HTML_OPTIONS=--to html5
PANDOC_PDF_OPTIONS=
PANDOC_DOCX_OPTIONS=
PANDOC_RTF_OPTIONS=
PANDOC_ODT_OPTIONS=
PANDOC_EPUB_OPTIONS=--to epub3
# Pattern-matching Rules
%.html : %.md
pandoc -s $(shell cat $<) $(PANDOC_OPTIONS) $(PANDOC_HTML_OPTIONS) -o $@
%.pdf : %.md
pandoc -s $(shell cat $<) $(PANDOC_OPTIONS) $(PANDOC_PDF_OPTIONS) -o $@
%.docx : %.md
pandoc -s $(shell cat $<) $(PANDOC_OPTIONS) $(PANDOC_DOCX_OPTIONS) -o $@
%.rtf : %.md
pandoc -s $(shell cat $<) $(PANDOC_OPTIONS) $(PANDOC_RTF_OPTIONS) -o $@
%.odt : %.md
pandoc -s $(shell cat $<) $(PANDOC_OPTIONS) $(PANDOC_ODT_OPTIONS) -o $@
%.epub : %.md
pandoc -s $(shell cat $<) $(PANDOC_OPTIONS) $(PANDOC_EPUB_OPTIONS) -o $@
all : $(EXPORTED_DOCS)
clean:
-rm -f $(EXPORTED_DOCS)
.PHONY: clean