This repository has been archived by the owner on Jan 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_docs.mk
65 lines (53 loc) · 1.47 KB
/
make_docs.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
BIBLIO = doc/bib/references.bib
REFSTYLE = doc/bib/ACL.csl
H_INC = doc/pandoc-h-inc.tex
INKSCAPE_CMD ?= inkscape
INKSC_OPTS ?= -C -d=300
INKSCAPE ?= $(INKSCAPE_CMD) $(INKSC_OPTS)
# little hack to have variable SPACE contain a whitespace
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
# setting flags and extensions for pandoc to use on documentation files
define pandoc_flags
-N \
--toc \
--toc-depth=1 \
--latex-engine=xelatex \
--include-in-header=$(H_INC) \
--bibliography $(BIBLIO) \
--csl=$(REFSTYLE) \
-V documentclass=report \
-V geometry:margin=3.0cm \
-V fontsize=11pt \
-V linkcolor="green"
endef
# disabled flags:
# -V mainfont="Linux Libertine O" \
# --listings \
# -V monofont="Dejavu Sans Mono - Book" \
define pandoc_extensions
fenced_code_blocks\
yaml_metadata_block\
pipe_tables\
table_captions\
inline_notes\
header_attributes
endef
# disabled extensions:
# mmd_title_block\
# pandoc_title_block\
# search for .pandoc files
doc_files = $(notdir $(shell find doc -type f -name '*.pandoc' | sort -n))
# search for .svg files
svg_sources = $(basename $(shell find doc/img -type f -iname '*.svg' -printf '%p ') )
# create names of target PNGs
png_exports = $(addsuffix .png, $(svg_sources))
vpath %.pandoc doc/
docs: SiMoN-Documentation.pdf
# SiMoN-Documentation.pdf: graphics
graphics: $(png_exports)
%.pdf: $(doc_files)
@pandoc $(pandoc_flags) -o $@ -f markdown$(subst $(SPACE),+,$(pandoc_extensions)) $^
@echo 'Documentation written to' $@
%.png: %.svg
$(INKSCAPE) -f $< -e $@