comparison makeBooke.sh @ 604:3b8a457ea3c9 build-default-243

Automated merge with ssh://hg.cryhavoc.org.uk/dottes
author Jim Hague <jim.hague@acm.org>
date Fri, 04 Nov 2016 17:59:19 +0000
parents ef0d66742e01
children d5357ee6b4b2
comparison
equal deleted inserted replaced
600:04fb44e2c9b7 604:3b8a457ea3c9
5 # The Booke tune content and all EPS and PDF tune graphics must be 5 # The Booke tune content and all EPS and PDF tune graphics must be
6 # present already. Run makeGraphics.sh first and then 6 # present already. Run makeGraphics.sh first and then
7 # makeBookeTunePages.sh. 7 # makeBookeTunePages.sh.
8 # 8 #
9 9
10 if [ $# != 2 ]; then 10 if [ $# -lt 2 ]; then
11 echo "Usage: makeBooke.sh <book dir name> <A4|A5>" 11 echo "Usage: makeBooke.sh <A4|A5> <book dir name> [<book dir name>...]"
12 exit 1 12 exit 1
13 fi 13 fi
14 14
15 dir=`pwd` 15 dir=`pwd`
16 16
17 booke=$dir/$1
18 papersize=$2
19 builddir=$dir/build 17 builddir=$dir/build
20 booketex=$dir/dottes.tex 18 booketex=$builddir/dottes.tex
21 bookepdf=$builddir/dottes.pdf 19 bookepdf=$builddir/dottes.pdf
22 20
21 papersize=$1
22 shift
23
23 mkdir -p $builddir 24 mkdir -p $builddir
25
26 if [ $# -eq 1 ]; then
27 bookename=$1
28 for item in title subtitle instrument
29 do
30 rm -f $builddir/$item.txt
31 if [ -r $1/$item.txt ]; then
32 cp $dir/$1/$item.txt $builddir/$item.txt
33 else
34 touch $builddir/$item.txt
35 fi
36 done
37 else
38 bookename="BumperBooke"
39 echo "The Bumper Booke" > $builddir/title.txt
40 echo "The collected Bookes of Bottes" > $builddir/subtitle.txt
41 rm -f $builddir/instrument.txt
42 if [ -r $1/instrument.txt ]; then
43 cp $1/instrument.txt $builddir/instrument.txt
44 else
45 touch $builddir/instrument.txt
46 fi
47 fi
24 48
25 cp dottes.tex $builddir 49 cp dottes.tex $builddir
26 cp buildno.txt $builddir 50 cp buildno.txt $builddir
27 cp buzzard.pdf $builddir 51 cp buzzard.pdf $builddir
28 for item in title subtitle instrument 52
53 rm -f $builddir/tunes.tex
54 rm -f $builddir/firstlines.tex
55
56 while [ $# -gt 0 ]
29 do 57 do
30 rm -f $builddir/$item.txt 58 section=$dir/$1
31 if [ -r $booke/$item.txt ]; then 59
32 cp $booke/$item.txt $builddir 60 for item in title subtitle instrument
33 else 61 do
34 touch $builddir/$item.txt 62 rm -f $builddir/$1-$item.txt
35 fi 63 if [ -r $section/$item.txt ]; then
36 done 64 cp $section/$item.txt $builddir/$1-$item.txt
37 for item in intro 65 else
38 do 66 touch $builddir/$1-$item.txt
39 rm -f $builddir/$item.tex 67 fi
40 if [ -r $booke/$item.md ]; then 68 done
41 pandoc --from=markdown --to=latex --output=$builddir/$item.tex $booke/$item.md 69 for item in intro
42 else 70 do
43 touch $builddir/$item.tex 71 rm -f $builddir/$1-$item.tex
44 fi 72 if [ -r $section/$item.md ]; then
73 pandoc --from=markdown --to=latex --output=$builddir/$1-$item.tex $section/$item.md
74 else
75 touch $builddir/$1-$item.tex
76 fi
77 done
78
79 sed -e "s/@SECTION@/$1/" dottes.tex.section-tunes >> $builddir/tunes.tex
80 sed -e "s/@SECTION@/$1/" dottes.tex.section-firstlines >> $builddir/firstlines.tex
81
82 shift
45 done 83 done
46 84
47 for filename in $dir/*.${papersize}.tex 85 for filename in $dir/*.${papersize}.tex
48 do 86 do
49 name=`basename $filename .${papersize}.tex` 87 name=`basename $filename .${papersize}.tex`
54 92
55 xelatex $booketex 93 xelatex $booketex
56 xelatex $booketex 94 xelatex $booketex
57 xelatex $booketex 95 xelatex $booketex
58 96
59 mv $bookepdf $dir/$1-${papersize}.pdf 97 mv $bookepdf $dir/$bookename-${papersize}.pdf
60 98
61 cd $dir 99 cd $dir