forked from covid-multivent/covid-multivent.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
executable file
·57 lines (49 loc) · 1.68 KB
/
publish.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
#!/bin/bash
# Generate the Slides and Pages
jupyter-nbconvert Notebooks/Index.ipynb --reveal-prefix=reveal.js --no-input
mv Notebooks/Index.html index.html
cd Notebooks
arr=(*.ipynb)
cd ..
for f in "${arr[@]}"; do
# Chop off the extension
filename=$(basename "$f")
extension="${filename##*.}"
filename="${filename%.*}"
# Convert the Notebook to HTML
jupyter-nbconvert --to html Notebooks/"$filename".ipynb --no-input
# Move to the Html directory
mv Notebooks/"$filename".html Html/"$filename".html
# Convert the Notebook to slides
jupyter-nbconvert --to slides Notebooks/"$filename".ipynb --no-input --reveal-prefix=reveal.js
# Move to the Slides directory
mv Notebooks/"$filename".slides.html Slides/"$filename".html
# Convert the Notebook to Markdown
jupyter-nbconvert --to markdown Notebooks/"$filename".ipynb --no-input
# Move to the Markdown directory
mv Notebooks/"$filename".md Markdown/"$filename".md
# Convert the Notebook to Latex
jupyter-nbconvert --to latex Notebooks/"$filename".ipynb --no-input
# Move to the Tex directory
mv Notebooks/"$filename".tex Tex/"$filename".tex
# Convert the Notebook to Pdf
cp Notebooks/"$filename".ipynb src/"$filename".ipynb
cd src
jupyter-nbconvert --to pdf "$filename".ipynb --no-input
# Move to the html directory
mv "$filename".pdf ../Pdfs/"$filename".pdf
rm "$filename".ipynb
cd ..
done
# Push the updates to gh-pages
mkdir -p /tmp/workspace
cp -r * /tmp/workspace/
git add -A .
git commit -m "Update Slides"
git checkout -B gh-pages
cp -r /tmp/workspace/* .
git add -A .
git commit -m "Update Slides"
git push origin master gh-pages
git checkout master
rm -rf /tmp/workspace