-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.sh
executable file
·69 lines (56 loc) · 1.86 KB
/
build.sh
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
#!/usr/bin/env bash
# Delete generated assets
rm -rf output
mkdir output
# Set CSS styles source
css="pdf.css"
echo "Using CSS styles from $css"
# Define starting directory
base_dir="$(pwd)"
# Create folder for general assets
mkdir output/general
# Generate general assets
for doc in general/*.md; do
# Generate assets as .pdf
if [ -f $doc ]; then
out="output/general/$(echo "$doc" | sed 's|/|-|g' | sed 's|.md|.pdf|')"
echo "Generating document from $doc to $out"
markdown-pdf "$doc" --out "$out" --cwd general --css-path "$css"
fi
done
# Copy technical files used by Remark
cp -r "slide-files" "output/"
# Go through each module
for mod in module-*; do
# Create folder for module
mkdir "output/$mod"
# Generate lesson plan .pdf
doc="$mod/README.md"
if [ -f $doc ]; then
out="output/$mod/$mod.pdf"
echo "Generating lesson plan from $doc to $out"
markdown-pdf "$doc" --out "$out" --cwd "$mod" --css-path "$css"
fi
# Generate handouts as .pdf
mkdir "output/$mod/handouts"
for doc in $mod/handouts/*.md; do
if [ -f $doc ]; then
out="output/$mod/handouts/$(echo "$doc" | sed 's|/|-|g' | sed 's|.md|.pdf|')"
echo "Generating handouts from $doc to $out"
markdown-pdf "$doc" --out "$out" --cwd "$mod/handouts" --css-path "$css"
fi
done
# Copy Remark presentation and generate .pdf copy with DeckTape
doc="presentation.html"
cd $mod
if [ -f $doc ]; then
# Generate .pdf
out="../output/$mod/handouts/$mod-presentation.pdf"
echo "Generating presentation from $mod/$doc to $out"
decktape remark "$doc" "$out" --chrome-arg=--allow-file-access-from-files
# Copy Remark presentation
cp -r "slide-images" "../output/$mod/"
cp "$doc" "../output/$mod/"
fi
cd $base_dir
done