-
Notifications
You must be signed in to change notification settings - Fork 44
/
Makefile
45 lines (41 loc) · 1.32 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
current_dir = $(shell pwd)
uid = $(shell id -u)
gid = $(shell id -g)
all: build
clean:
rm -rf dist; mkdir dist;
tutorial: clean
for f in 01*/*.md; do (cat $$f) >> dist/Book.md; done;
pandoc -o dist/Book.ipynb metadata.yaml dist/Book.md;
rm -rf dist/Book.md
build: clean
# Create Book.md by simply concatenating all .md files together
for f in */*.md; do (echo "\n\\pagebreak\n\n"; cat $$f) >> dist/Book.md; done;
# Run pandoc in Docker
# Generate pdf
docker run \
--rm \
--user $(uid):$(gid) \
-v $(current_dir)/metadata.yaml:/metadata.yaml \
-v $(current_dir)/dist:/dist \
-v $(current_dir)/images:/images \
--workdir /dist \
pandoc/latex:2.14 --highlight-style=breezedark -o /dist/Book.pdf /metadata.yaml /dist/Book.md
# Generate epub
docker run \
--rm \
--user $(uid):$(gid) \
-v $(current_dir)/metadata.yaml:/metadata.yaml \
-v $(current_dir)/dist:/dist \
-v $(current_dir)/images:/images \
--workdir /dist \
pandoc/latex:2.14 --highlight-style=breezedark -o /dist/Book.epub /metadata.yaml /dist/Book.md
# Generate html
docker run \
--rm \
--user $(uid):$(gid) \
-v $(current_dir)/metadata.yaml:/metadata.yaml \
-v $(current_dir)/dist:/dist \
-v $(current_dir)/images:/images \
--workdir /dist \
pandoc/latex:2.14 --highlight-style=breezedark -o /dist/Book.html /metadata.yaml /dist/Book.md