forked from tomeshnet/p2p-internet-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·54 lines (46 loc) · 1.49 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
#!/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"
# Generate general assets
for doc in general/*.md; do
# Create folder for general assets
mkdir output/general
# 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
# Go through each module
for mod in module-*; do
# Create folder for module
mkdir "$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 worksheets as .pdf
mkdir "output/$mod/worksheet"
for doc in $mod/worksheet/*.md; do
if [ -f $doc ]; then
out="output/$mod/worksheet/$(echo "$doc" | sed 's|/|-|g' | sed 's|.md|.pdf|')"
echo "Generating worksheet from $doc to $out"
markdown-pdf "$doc" --out "$out" --cwd "$mod/worksheet" --css-path "$css"
fi
done
# Generate presentation GitBook
book="$mod/presentation"
if [ -d $book ]; then
out="output/$mod/presentation"
echo "Generating presentation from $book to $out"
gitbook build "$book" "$out"
fi
done