-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild_book
executable file
·35 lines (22 loc) · 999 Bytes
/
build_book
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
#!/bin/bash
# 1. Check we're in the base directory
if [[ `basename "$PWD"` != "qubit.guide" ]]; then
echo "Script must be run from the main qubit.guide directory" >&2
exit 1
else
echo "Building book..."
fi
# 2. Delete previous build
R -e "bookdown::clean_book(TRUE)"
# 3. Build the various versions of the book
## Web
R -e "bookdown::render_book('index.Rmd','bookdown::gitbook',config_file='_bookdown.yml')"
## B5 book PDF
R -e "bookdown::render_book('index.Rmd','bookdown::pdf_book',config_file='_bookdown.yml',output_options=list(template='latex/latex-template-b5.tex'))"
mv book/qubit_guide.pdf book/qubit_guide_b5.pdf
## A4 PDF
R -e "bookdown::render_book('index.Rmd','bookdown::pdf_book',config_file='_bookdown.yml')"
# 4. Post-build changes (i.e. messy hacks)
# Replace some gitbook js files with our custom version
cp web/plugin-bookdown.js book/libs/gitbook-2.6.7/js/plugin-bookdown.js
cp web/plugin-fontsettings.js book/libs/gitbook-2.6.7/js/plugin-fontsettings.js