forked from S3-working-group/s3-practical-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
93 lines (73 loc) · 2.73 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
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
86
87
88
89
90
91
92
93
TMP=tmp
PROJECT=config/project.yaml
# get language specific parameters
include config/local-conf
make translations:
mdtemplate default $(PROJECT) templates/version.txt content/version.txt
# it's intentional this is just echoed
echo "sudo crowdin upload sources --dryrun"
version:
mdtemplate default $(PROJECT) templates/version.txt content/version.txt
site:
# build jekyll site
mdbuild jekyll $(PROJECT) -vv
mdbuild all-in-one-jekyll-page $(PROJECT) -vv
cd docs;jekyll build
debug:
# build with debug output (for quickly testing changes to structure.yaml or project.yaml)
mdbuild all-in-one-jekyll-page $(PROJECT) -vvvv
epub:
# render an ebook as epub
echo $(TARGETFILE)
mdbuild epub $(PROJECT) -vv
cd $(TMP); pandoc epub-compiled.md -f markdown -t epub3 --toc --toc-depth=3 -s -o ../$(TARGETFILE).epub
docx:
# render an ebook as epub
echo $(TARGETFILE)
mdbuild epub $(PROJECT) -vv
cd $(TMP); pandoc epub-compiled.md -f markdown -t docx --toc --toc-depth=3 -s -o ../$(TARGETFILE).docx
supporter-epub:
# render epub for supporter edition
# mdbuild supporter-epub $(PROJECT) -vv
# prepare description html and add to metadata
pandoc content/src/introduction/s3-overview-supporter-edition.md -f markdown_mmd -t html -o $(TMP)/description.html
cd $(TMP); tr -d "\n" <description.html >description-one-line.html
cd $(TMP); awk 'BEGIN{RS = "\n\n+" getline l < "description-one-line.html"}/htmldescription/{gsub("htmldescription",l)}1' supporter-edition-metadata.yaml >metadata-full.yaml
# make epub via pandoc
# cd $(TMP); pandoc supporter-epub-compiled.md -f markdown --metadata-file=metadata-full.yaml -t epub3 --toc --toc-depth=3 -s -o ../$(TARGETFILE)-supporter-edition.epub
ebook:
# render an ebook as pdf (via LaTEX)
mdbuild ebook $(PROJECT) -vv
cd $(TMP); multimarkdown --to=latex --output=ebook-compiled.tex ebook-compiled.md
cd $(TMP); latexmk -pdf -xelatex -silent ebook.tex
# merge with cover
cd $(TMP); gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf ../templates/ebook-cover.pdf ebook.pdf
cd $(TMP); mv merged.pdf ../$(TARGETFILE).pdf
# clean up
cd $(TMP); latexmk -C
gitbook:
# mdslides build gitbook $(CONFIG) $(SOURCE) gitbook/ --glossary=$(GLOSSARY)
clean:
# clean all generated content
-rm -r docs/img
-rm -r docs/_site
-rm docs/*.md
# take no risk here!
-rm -r tmp
setup:
# prepare temp folders and jekyll site
echo "this might produce error output if folders already exist"
-mkdir -p $(TMP)
-mkdir docs/_site
# copy images to temp folder
ifneq ("$(wildcard $(TMP)/img)","")
# take no risk here!
rm -r $(TMP)/img
endif
cp -r img $(TMP)/img
cp templates/covers/* $(TMP)/img
# clean up and copy images do to docs folder
ifneq ("$(wildcard docs/img)","")
rm -r docs/img
endif
cp -r img docs/img