-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.sh
executable file
·63 lines (52 loc) · 1.32 KB
/
build.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
58
59
60
61
62
#!/bin/bash
rm -rf build/*.pdf
pdfname="ogc-tutorial"
list_of_slides=list_of_slides_to_build.txt
rsts=""
# creates a pdf for the list of slides
while read x
do
len=${#x} # of the string in the list of slides
if [ $len -gt 0 ]
then
pre=${x:0:2} # extract first letter of string
if [ pre!="#" ]
then
buildFolder=${x%/*}/build # where to put the pdf
echo "buildFolder" $buildFolder
mkdir $buildFolder
fileName=${x##*/} # file name to be created
rst2pdf $x.rst -b 2 -s slides.style -o $buildFolder/$fileName.pdf -q
fi
fi
done < $list_of_slides
i=1
while read x
do
if [ ${#x} -gt 0 ]
then
if [ ${#i} -eq 1 ]
then
prefix="00$i"
elif [ ${#i} -eq 2 ]
then
prefix="0$i"
else
prefix="$i"
fi
fileName="${x##*/}.pdf"
cp ${x%/*}/build/${x##*/}.pdf build/$prefix"_"$fileName #copy to build from the pdfs created
let i=i+1
fi
done < $list_of_slides
# remove all the temporary build files
while read x
do
if [ ${#x} -gt 0 ]
then
rm -rf ${x%/*}/build
fi
done < $list_of_slides
# build in the root build folder
cd build
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=ogc-tutorial.pdf `ls *.pdf`