-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
109 lines (86 loc) · 3.02 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
MATHJAX=http://cdn.mathjax.org/mathjax/latest
LIQUIDCLIENT=../liquid-client
SLIDES=dist/_slides
SITE=dist/_site
DIST=dist/_build
TEMPLATES=assets/templates
FILTERS=assets/filters
JS=assets/js
CSS=assets/css
IMG=assets/img
##############################################
PANDOC=pandoc
INDEXER=$(FILTERS)/Toc.hs
METATEMPLATE=$(TEMPLATES)/pagemeta.template
INDEXTEMPLATE=$(TEMPLATES)/index.template
PREAMBLE=$(TEMPLATES)/preamble.lhs
BIB=$(TEMPLATES)/bib.lhs
# generated
PAGETEMPLATE=$(DIST)/page.template
LINKS=$(DIST)/links.txt
INDEX=$(DIST)/index.lhs
##############################################
PANDOCHTML=$(PANDOC)\
--from=markdown+lhs \
--to=html5 \
-s --mathjax \
--standalone \
--parse-raw \
--mathjax \
--toc \
--section-divs \
--filter $(LIQUIDCLIENT)/templates/codeblock.hs \
--filter $(FILTERS)/Figures.hs \
--filter $(FILTERS)/Html.hs \
--variable=notitle \
--highlight-style=tango
REVEAL=$(PANDOC)\
--from=markdown\
--to=html5 \
--standalone \
--mathjax \
--section-divs \
--filter $(FILTERS)/Slides.hs \
--template=$(TEMPLATES)/template.reveal \
--variable reveal=js/reveal.js \
--variable mathjax=$(MATHJAX)
# LIQUID=liquid --short-names
####################################################################
lhsObjects := $(wildcard src/*.lhs)
texObjects := $(patsubst %.lhs,%.tex,$(wildcard src/*.lhs))
htmlObjects := $(patsubst %.lhs,%.html,$(wildcard src/*.lhs))
mdObjects := $(patsubst %.lhs,%.lhs.markdown,$(wildcard src/*.lhs))
slideObjects := $(patsubst %.lhs,%.lhs.slide.html,$(wildcard src/*.lhs))
####################################################################
all: html
################ rust style html ###################################
html: indexhtml $(htmlObjects)
cp src/*.html $(SITE)/
cp -r $(IMG) $(SITE)/
cp -r $(CSS) $(SITE)/
cp -r $(LIQUIDCLIENT)/fonts $(SITE)/
cp -r $(LIQUIDCLIENT)/css $(SITE)/
cp -r $(LIQUIDCLIENT)/js $(SITE)/
indexhtml: $(INDEX)
$(PANDOC) --from=markdown+lhs --to=html5 --template=$(INDEX) $(PREAMBLE) -o $(SITE)/index.html
$(INDEX):
$(INDEXER) src/ $(METATEMPLATE) $(INDEXTEMPLATE) $(PAGETEMPLATE) $(INDEX) $(LINKS)
src/%.html: src/%.lhs
PANDOC_TARGET=$@ PANDOC_CODETEMPLATE=$(LIQUIDCLIENT)/templates/code.template $(PANDOCHTML) --template=$(PAGETEMPLATE) $(PREAMBLE) $? $(TEMPLATES)/bib.lhs -o $@
################ reveal slides html ###################################
slides: $(slideObjects)
mv src/*.html $(SLIDES)/
cp -r $(IMG) $(SLIDES)/
cp -r $(JS) $(SLIDES)/
cp -r $(CSS) $(SLIDES)/
src/.liquid/%.lhs.markdown: src/%.lhs
-$(LIQUID) $?
src/%.lhs.slide.html: src/.liquid/%.lhs.markdown
$(REVEAL) $? -o $@
################ CLEAN and SYNC #######################################
clean:
rm -rf $(DIST)/* && rm -rf $(SITE)/* && rm -rf src/*.tex && rm -rf src/.liquid && rm -rf src/*.html
#clean:
# cd lhs/ && ../cleanup && cd ../
# cd html/ && rm -rf * && cd ../
# cp index.html html/