forked from mlhubber/mlmodels
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpandoc.mk
86 lines (62 loc) · 1.91 KB
/
pandoc.mk
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
########################################################################
#
# Makefile template for Document Format Conversion - pandoc
#
# Copyright 2018 (c) Graham.Williams@togaware.com
#
# License: Creative Commons Attribution-ShareAlike 4.0 International.
#
########################################################################
# I think the geometry for LaTeX should be a4 rather than a4paper to
# work with newer LaTeX. Should only need lang which pandoc should
# underneath also set babel-lang but that does not seem to be working
# 20171230 (reference man page).
PANDOC_PDF_OPTIONS=-V urlcolor=cyan -V geometry=a4paper -V lang=british -V babel-lang=british --number-sections
PANDOC_TEX_OPTIONS=$(PANDOC_PDF_OPTIONS) --standalone
PANDOC_CSS=pandoc.css
PANDOC_HTML_OPTIONS=--standalone --self-contained
ifneq ("$(wildcard $(PANDOC_CSS))","")
PANDOC_HTML_OPTIONS := $(PANDOC_HTML_OPTIONS) --include-in-header=$(PANDOC_CSS)
endif
define PANDOC_HELP
Conversion of document formats using pandoc:
Inpute formats:
org Emacs org mode (the original);
rst Attempt to improve markdown;
md Mardown documents;
Output foramts:
html
pdf
view View the generated PDF document.
Example:
$ make README.view # Generate and display .pdf from .org.
Default conversion options:
PDF: $(PANDOC_PDF_OPTIONS)
TEX: $(PANDOC_TEX_OPTIONS)
HTML: $(PANDOC_HTML_OPTIONS)
endef
export PANDOC_HELP
help::
@echo "$$PANDOC_HELP"
%.txt: %.rst
pandoc $< -o $@
%.txt: %.md
pandoc $< -o $@
%.docx: %.org
pandoc $(PANDOC_PDF_OPTIONS) $< -o $@
%.html: %.org
pandoc -o $@ $<
%.html: %.rst
pandoc $(PANDOC_HTML_OPTIONS) -o $@ $<
%.tex: %.org
pandoc $(PANDOC_TEX_OPTIONS) $< -o $@
%.tex: %.rst
pandoc $(PANDOC_TEX_OPTIONS) $< -o $@
%.pdf: %.org
pandoc $(PANDOC_PDF_OPTIONS) $< -o $@
%.pdf: %.rst
pandoc $(PANDOC_PDF_OPTIONS) $< -o $@
%.pdf: %.md
pandoc $(PANDOC_PDF_OPTIONS) $< -o $@
%.view: %.pdf
atril $<