-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_slides.sh
executable file
·54 lines (47 loc) · 1.4 KB
/
build_slides.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
IN=src/slides
OUT=_build/html/src/slides
mkdir -p $OUT
build_deck () {
if [[ $1 == *.ipynb ]]; then
# Convert it to slides
jupyter nbconvert $IN/$1 --to slides --output-dir=$OUT
else
# Replace current extension with .ipynb
fname=${1%.*}.ipynb
# Convert current notebook format into Jupyter Notebook
jupytext --to notebook --output $OUT/$fname $IN/$1
# Convert it to slides
jupyter nbconvert $OUT/$fname --to slides --output-dir=$OUT
# Remove the notebook
rm $OUT/$fname
fi
}
build_exec_deck () {
if [[ $1 == *.ipynb ]]; then
# Make a copy
cp $IN/$1 $OUT/
fname=$1
else
# Replace current extension with .ipynb
fname=${1%.*}.ipynb
# Convert current notebook format into Jupyter Notebook
jupytext --to notebook --output $OUT/$fname $IN/$1
fi
# Execute it in-place
jupyter nbconvert --execute --inplace $OUT/$fname
# Convert it to slides
jupyter nbconvert $OUT/$fname --to slides --output-dir=$OUT
# Remove the notebook
rm $OUT/$fname
}
# poster
mkdir -p _build/html/src/poster
cp src/poster/yowt_poster.pdf _build/html/src/poster/
# slides
mkdir -p _build/html/src/img/slides
cp -r src/img/slides _build/html/src/img/
mkdir -p _build/html/_sources/src/slides
cp src/slides/yowt_slides.css _build/html/_sources/src/slides/
cp src/slides/yowt_slides.css _build/html/src/slides/custom.css
build_exec_deck yowt_slides.md