-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_slides.sh
executable file
·47 lines (41 loc) · 1.18 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
#! /usr/bin/env bash
IN=src/text
OUT=_build/html/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
}
build_exec_deck bayesian_networks-mnb.md
build_exec_deck bayesian_networks-jnb.ipynb
build_exec_deck bayesian_networks-pnb.py
build_deck bayesian_networks-sp-mnb.md