Newer
Older
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
# .SUFFIXES: .html .md
PROJECT:=$(shell basename `pwd`)
BASEDIR:=$(shell echo `pwd`)
########## config.mk
# config.mk is expected to set:
# REMOTE_USER:= "marcus"
# REMOTE_HOST := "hardt-it.de"
# REMOTE_DIR := "public_html"
# REMOTE_URL := "http://${REMOTE_USER}.${REMOTE_HOST}/${PROJECT}"
# REVEAL_USER := ${REMOTE_USER}
# REVEAL_HOST := ${REMOTE_USER}.${REMOTE_HOST}
# REVEAL_DIR := "public_html/reveal.js"
# REVEAL_URL_DIR := "/reveal.js"
# REVEAL_URL := "${REVEAL_URL_DIR}"
-include config.mk
-include ${HOME}/.config/make-reveal/config.mk
### Read more config from markdown file header:
# REMOTE_USER
TEMP:=$(shell grep -B 100 '\-\-\-' $(PROJECT).md | grep ^REMOTE_USER: | cut -d: -f 2 | sed s/\ *//)
ifneq ($(TEMP),)
REMOTE_USER:=${TEMP}
XY:="aaa"
endif
# REMOTE_HOST
TEMP:=$(shell grep -B 100 '\-\-\-' $(PROJECT).md | grep ^REMOTE_HOST: | cut -d: -f 2 | sed s/\ *//)
ifneq ($(TEMP),)
REMOTE_HOST:=${TEMP}
XY:="aaa"
endif
# REMOTE_URL
PROTO:=$(shell grep -B 100 '\-\-\-' $(PROJECT).md | grep ^REMOTE_URL: | cut -d: -f 2 | sed s#\ *##)
TEMP:=$(shell grep -B 100 '\-\-\-' $(PROJECT).md | grep ^REMOTE_URL: | cut -d: -f 3 | sed s#\ *##)
ifneq ($(TEMP),)
REMOTE_URL :=${PROTO}:${TEMP}
endif
# REVEAL_DIR
TEMP:=$(shell grep -B 100 '\-\-\-' $(PROJECT).md | grep ^REVEAL_DIR: | cut -d: -f 2 | sed s/\ *//)
ifneq ($(TEMP),)
REVEAL_DIR :=${TEMP}
endif
# REVEAL_URL
TEMP:=$(shell grep -B 100 '\-\-\-' $(PROJECT).md | grep ^REVEAL_URL: | cut -d: -f 2 | sed s/\ *//)
ifneq ($(TEMP),)
REVEAL_URL :=${TEMP}
endif
### Derive Variables:
REMOTE := ${REMOTE_HOST}:~/${REMOTE_DIR}/${PROJECT}
REVEAL := ${REVEAL_HOST}:~/${REVEAL_DIR}
vpath %.md markdown
vpath %.html html
.DEFAULT_GOAL := default
info:
@echo "REMOTE_USER: ${REMOTE_USER} "
@echo "REMOTE_HOST: ${REMOTE_HOST} "
@echo "REMOTE_DIR: ${REMOTE_DIR} "
@echo "REMOTE_URL: ${REMOTE_URL} "
@echo "REVEAL_USER: ${REVEAL_USER} "
@echo "REVEAL_HOST: ${REVEAL_HOST} "
@echo "REVEAL_DIR: ${REVEAL_DIR} "
@echo "REVEAL_URL: ${REVEAL_URL} "
@echo ""
@echo "REVEAL: ${REVEAL} "
@echo "REMOTE: ${REMOTE} "
@echo "PROJECT: ${PROJECT} "
%.html: %.md reveal.js
@pandoc -t revealjs --mathml --standalone -f markdown -V revealjs-url=reveal.js -o $@-preview.html $<
@pandoc -t revealjs --mathml --standalone -f markdown -V revealjs-url=$(REVEAL_URL) -o $@ $<
#@pandoc -t revealjs --webtex --standalone -f markdown -V revealjs-url=reveal.js -o $@-preview.html $<
#@pandoc -t revealjs --webtex --standalone -f markdown -V revealjs-url=$(REVEAL_URL) -o $@ $<
@#pandoc -t revealjs --standalone -f markdown -o $@ $<
@#pandoc -t revealjs --mathjax --self-contained --standalone -f markdown -o $@ $<
@#pandoc -t revealjs --self-contained --standalone -f markdown -o $@ $<
remote-reveal: reveal.js
@#@ssh ${REVEAL_HOST} 'test -d ${REVEAL_DIR} && rm -rf ${REVEAL_DIR}'
@#scp -rp reveal.js ${REVEAL}
@echo rsync -rlutopgx reveal.js/ ${REVEAL_USER}@${REVEAL}/
@rsync -rlutopgx reveal.js/ ${REVEAL_USER}@${REVEAL}/
default: ${PROJECT}.html
@echo ""
reveal.js:
@git clone https://github.com/hakimel/reveal.js.git -b 3.9.2 > /dev/null 2>&1
#@curl -s marcus.hardt-it.de/reveal-theme-marcus.css > reveal.js/css/theme/marcus.css
@curl -s https://marcus.hardt-it.de/reveal-themes/marcus.css > reveal.js/css/theme/marcus.css
@curl -s https://marcus.hardt-it.de/reveal-themes/marcus-large.css > reveal.js/css/theme/marcus-large.css
@curl -s https://marcus.hardt-it.de/reveal-themes/marcus-black.css > reveal.js/css/theme/marcus-black.css
@curl -s https://marcus.hardt-it.de/reveal-themes/marcus-black-large.css > reveal.js/css/theme/marcus-black-large.css
@curl -s https://marcus.hardt-it.de/reveal-themes/marcus-common.css > reveal.js/css/theme/marcus-common.css
@test -d images || mkdir images
publish: reveal.js default
@echo "\nPublishing (via ${REMOTE_USER}@${REMOTE}) to $(REMOTE_URL)\n"
@ssh ${REMOTE_USER}@${REMOTE_HOST} "cd ${REMOTE_DIR}/; test -e `basename ${REMOTE}` || mkdir `basename ${REMOTE}`"
@scp ${PROJECT}.html ${REMOTE_USER}@${REMOTE}/index.html > /dev/null
@rsync -rlutopgx images ${REMOTE_USER}@${REMOTE}/
@echo "Done"
view-remote: publish
@xdg-open file://$(BASEDIR)/$(PROJECT).html-preview.html >/dev/null 2>&1 &
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
144
145
146
publish-all: publish
@ssh hardt-it.de "cd web/`basename ${REMOTE}`; test -e reveal.js || ln -s ../reveal.js ."
.PHONY: clean
clean:
rm -f *.html *.pdf
rm -f screenshots/*
.PHONY: distclean
distclean: clean
rm -rf reveal.js
.PHONY: pdf
pdf: ${PROJECT}.html
test -d screenshots || mkdir screenshots
docker run -it --rm -t -v `pwd`:/slides -v `pwd`:/home/user astefanutti/decktape \
reveal \
-s 1920x1200 \
--screenshots \
--screenshots-size=1920x1200 \
--screenshots-format png \
--screenshots-directory screenshots \
--chrome-arg=--disable-web-security \
/home/user/${PROJECT}.html-preview.html \
${PROJECT}-delme.pdf
rm ${PROJECT}-delme.pdf
convert `find screenshots -type f| sort -t_ -n -k2` ${PROJECT}.pdf