annotate makeBooke.sh @ 312:8bc92e044e0a

Move tune and first line inclusion code into macros. Also use tune title, not name, as hyperlink targets. This removes the need to pass the name into the macros.
author Jim Hague <jim.hague@acm.org>
date Fri, 12 Jul 2013 11:36:14 +0100
parents 9c5cabaabbec
children 55afb58d4a9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
1 #!/bin/bash
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
2 #
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
3 # Build the Booke. Move subfiles into place and build the Booke into a PDF.
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
4 #
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
5 # The Booke tune content and all EPS and PDF tune graphics must be
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
6 # present already. Run makeGraphics.sh first and then
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
7 # makeBookeTunePages.sh.
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
8 #
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
9
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
10 if [ $# != 2 ]; then
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
11 echo "Usage: makeBooke.sh <book dir name> <A4|A5>"
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
12 exit 1
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
13 fi
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
14
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
15 dir=`pwd`
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
16
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
17 booke=$dir/$1
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
18 papersize=$2
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
19 builddir=$dir/build
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
20 graphicsdir=$dir/graphics/$1
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
21 booketex=$dir/dottes.tex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
22 bookepdf=$builddir/dottes.pdf
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
23
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
24 mkdir -p $builddir
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
25
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
26 cp dottes.tex $builddir
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
27 cp buildno.txt $builddir
304
9c5cabaabbec Replace buzzard EPS with cropped PDF.
Jim Hague <jim.hague@acm.org>
parents: 266
diff changeset
28 cp buzzard.pdf $builddir
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
29 for item in title subtitle intro instrument
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
30 do
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
31 rm -f $builddir/$item.txt
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
32 if [ -r $booke/$item.txt ]; then
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
33 cp $booke/$item.txt $builddir
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
34 else
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
35 touch $builddir/$item.txt
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
36 fi
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
37 done
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
38
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
39 for filename in $dir/*.${papersize}.tex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
40 do
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
41 name=`basename $filename .${papersize}.tex`
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
42 cp $filename $builddir/$name.tex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
43 done
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
44
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
45 cd $builddir
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
46
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
47 xelatex $booketex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
48 xelatex $booketex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
49 xelatex $booketex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
50
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
51 mv $bookepdf $dir/$1-${papersize}.pdf
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
52
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
53 cd $dir