forked from S3-working-group/s3-practical-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
143 lines (114 loc) · 5.31 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
CONFIG=content/structure-new.yaml
GLOSSARY=content/glossary.yaml
SOURCE=content/src
TMPFOLDER=tmp
LOC=content/localization.po
PRJ=config/project.yaml
MKTPL=mdslides template
# get language specific parameters
include config/make-conf
define update-make-conf
# update the make conf file from translations
$(MKTPL) templates/make-conf config/make-conf $(LOC) $(PRJ)
endef
deckset:
$(update-make-conf)
# build deckset presentation and add pattern index
mdslides compile $(CONFIG) $(SOURCE) $(TMPFOLDER) --chapter-title=img --glossary=$(GLOSSARY) --section-prefix="$(SECTIONPREFIX)"
$(MKTPL) templates/deckset-template.md $(TMPFOLDER)/deckset-template.md $(LOC) $(PRJ)
mdslides build deckset $(CONFIG) $(TMPFOLDER) $(TARGETFILE).md --template=$(TMPFOLDER)/deckset-template.md --glossary=$(GLOSSARY) --glossary-items=16
# append pattern-index
mdslides index deckset $(CONFIG) $(TARGETFILE).md --append
revealjs:
$(update-make-conf)
$(MKTPL) templates/revealjs-template.html $(TMPFOLDER)/revealjs-template.html $(LOC) $(PRJ)
mdslides compile $(CONFIG) $(SOURCE) $(TMPFOLDER) --chapter-title=text --glossary=$(GLOSSARY) --section-prefix="$(SECTIONPREFIX)"
mdslides build revealjs $(CONFIG) $(TMPFOLDER) docs/slides.html --template=$(TMPFOLDER)/revealjs-template.html --glossary=$(GLOSSARY) --glossary-items=8
site:
# build jekyll site
$(update-make-conf)
# prepare templates
$(MKTPL) templates/docs/_layouts/default.html docs/_layouts/default.html $(LOC) $(PRJ)
$(MKTPL) templates/docs/_config.yml docs/_config.yml $(LOC) $(PRJ)
$(MKTPL) templates/docs/CNAME docs/CNAME $(LOC) $(PRJ)
$(MKTPL) content/website/_includes/footer.html docs/_includes/footer.html $(LOC) $(PRJ)
cp templates/docs/map.md docs/map.md
cp templates/docs/pattern-map.html docs/_includes/pattern-map.html
cp content/website/_includes/header.html docs/_includes/header.html
mdslides build jekyll $(CONFIG) $(SOURCE) docs/ --glossary=$(GLOSSARY) --template=content/website/_templates/index.md --section-index-template=content/website/_templates/pattern-index.md --introduction-template=content/website/_templates/introduction.md
cd docs;jekyll build
wordpress:
# join each pattern group into one md file to be used in wordpress
$(update-make-conf)
ifeq ("$(wildcard $(TMPFOLDER)/web-out)","")
mkdir $(TMPFOLDER)/web-out
endif
mdslides compile $(CONFIG) $(SOURCE) $(TMPFOLDER) --chapter-title=none --glossary=$(GLOSSARY) --section-prefix="$(SECTIONPREFIX)"
mdslides build wordpress $(CONFIG) $(TMPFOLDER) $(TMPFOLDER)/web-out/ --footer=templates/wordpress-footer.md --glossary=$(GLOSSARY)
epub:
# render an ebook as epub
$(update-make-conf)
# render intro, chapters and appendix to separate md files
mdslides build ebook $(CONFIG) $(SOURCE) $(TMPFOLDER)/ebook/ --glossary=$(GLOSSARY) --section-prefix="$(SECTIONPREFIX)"
# prepare and copy template
$(MKTPL) templates/epub--master.md $(TMPFOLDER)/ebook/epub--master.md $(LOC) $(PRJ)
# transclude all to one file
cd $(TMPFOLDER)/ebook; multimarkdown --to=mmd --output=epub-compiled.md epub--master.md
# render to epub
cd $(TMPFOLDER)/ebook; pandoc epub-compiled.md -f markdown -t epub3 --toc --toc-depth=3 -s -o ../../$(TARGETFILE).epub
ebook:
# render an ebook as pdf (via LaTEX)
$(update-make-conf)
# render intro, chapters and appendix to separate md files (but without sectionprefix!)
mdslides build ebook $(CONFIG) $(SOURCE) $(TMPFOLDER)/ebook/ --glossary=$(GLOSSARY) --no-section-prefix
# copy md and LaTEX templates
$(MKTPL) templates/ebook--master.md $(TMPFOLDER)/ebook/ebook--master.md $(LOC) $(PRJ)
$(MKTPL) config/ebook.tex $(TMPFOLDER)/ebook/ebook.tex $(LOC) $(PRJ)
$(MKTPL) config/ebook-style.sty $(TMPFOLDER)/ebook/ebook-style.sty $(LOC) $(PRJ)
# make an index
mdslides index latex content/structure-new.yaml $(TMPFOLDER)/ebook/tmp-index.md
# transclude all to one file
cd $(TMPFOLDER)/ebook; multimarkdown --to=mmd --output=tmp-ebook-compiled.md ebook--master.md
cd $(TMPFOLDER)/ebook; multimarkdown --to=latex --output=tmp-ebook-compiled.tex tmp-ebook-compiled.md
cd $(TMPFOLDER)/ebook; latexmk -pdf -xelatex -silent ebook.tex
cd $(TMPFOLDER)/ebook; mv ebook.pdf ../../$(TARGETFILE).pdf
# clean up
cd $(TMPFOLDER)/ebook; latexmk -C
single:
$(update-make-conf)
$(MKTPL) templates/single-page--master.md $(TMPFOLDER)/ebook/single-page--master.md $(LOC) $(PRJ)
# render intro, chapters and appendix to separate md files
mdslides build ebook $(CONFIG) $(SOURCE) $(TMPFOLDER)/ebook/ --glossary=$(GLOSSARY)
# transclude all to one file
cd $(TMPFOLDER)/ebook; multimarkdown --to=mmd --output=../../docs/all.md single-page--master.md
gitbook:
mdslides build gitbook $(CONFIG) $(SOURCE) gitbook/ --glossary=$(GLOSSARY)
update:
$(update-make-conf)
clean:
# clean all generated content
-rm -r docs/img
-rm -r docs/_site
-rm docs/*.md
-rm -r $(TMPFOLDER)
setup:
# prepare temp folders and jekyll site
$(update-make-conf)
# prepare temp folders
echo "this might produce error output if folders already exist"
-mkdir -p $(TMPFOLDER)/ebook
-mkdir -p $(TMPFOLDER)/web-out
-mkdir docs/_site
# -mkdir gitbook
ifeq ("$(wildcard $(TMPFOLDER)/ebook/img)","")
cd $(TMPFOLDER)/ebook; ln -s ../../img
endif
# clean up and copy images do to docs folder
ifneq ("$(wildcard docs/img)","")
rm -r docs/img
endif
cp -r img docs/img
ifneq ("$(wildcard gitbook/img)","")
# rm -r gitbook/img
endif
# cp -r img gitbook/img