Skip to content

Commit 67fe23b

Browse files
committed
Restructure and add build script for generating class material
1 parent a14d087 commit 67fe23b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+72
-28
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Generated asset directory
2+
output
3+
4+
# GitBook
5+
_book
6+
book.pdf
7+
book.epub
8+
book.mobi

README.md

Lines changed: 7 additions & 7 deletions

build

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
# Check for required tools
4+
echo "Checking for markdown-pdf node module"
5+
npm -g list markdown-pdf
6+
S=$?
7+
if [ $S -ne 0 ]; then
8+
echo "markdown-pdf is missing, install by running:"
9+
echo " npm install -g markdown-pdf"
10+
return $S
11+
fi
12+
13+
echo "Checking for gitbook-cli node module"
14+
npm -g list gitbook-cli
15+
S=$?
16+
if [ $S -ne 0 ]; then
17+
echo "gitbook-cli is missing, install by running:"
18+
echo " npm install -g gitbook-cli"
19+
return $S
20+
fi
21+
22+
# Delete generated assets
23+
rm -rf output
24+
mkdir output
25+
26+
# Get absolute path to pdf.css
27+
basedir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28+
css="$basedir/pdf.css"
29+
echo "Using CSS styles from $css"
30+
31+
# Go through each module
32+
for mod in module-*; do
33+
# Generate lesson plans .pdf
34+
doc="$mod/README.md"
35+
if [ -f $doc ]; then
36+
out="output/$mod.pdf"
37+
echo "Generating lesson plan from $doc to $out"
38+
markdown-pdf "$doc" --out "$out" --cwd "$mod" --css-path pdf.css
39+
fi
40+
41+
# Generate worksheets as .pdf
42+
for doc in $mod/worksheet/*.md; do
43+
if [ -f $doc ]; then
44+
out="output/$(echo "$doc" | sed 's|/|-|g' | sed 's|.md|.pdf|')"
45+
echo "Generating worksheet from $doc to $out"
46+
markdown-pdf "$doc" --out "$out" --cwd "$mod/worksheet" --css-path pdf.css
47+
fi
48+
done
49+
50+
# Generate presentation GitBooks
51+
book="$mod/presentation"
52+
if [ -d $book ]; then
53+
out="output/$(echo "$book" | sed 's|/|-|g')"
54+
echo "Generating presentation from $book to $out"
55+
gitbook build "$book" "$out"
56+
fi
57+
done
File renamed without changes.

materials/module-1/presentation/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

materials/module-1/presentation/serve-presentation

Lines changed: 0 additions & 4 deletions
This file was deleted.

materials/module-1/worksheets/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

materials/module-1/worksheets/generate-pdf

Lines changed: 0 additions & 12 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)