annotate makeBooke.sh @ 654:31cec1d79cb6 build-default-257

Add acute accent to Laride.
author Jim Hague <jim.hague@acm.org>
date Mon, 21 Nov 2016 22:07:03 +0000
parents d5357ee6b4b2
children 7ad6c0aa958d
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
603
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
10 if [ $# -lt 2 ]; then
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
11 echo "Usage: makeBooke.sh <A4|A5> <book dir name> [<book dir name>...]"
266
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 builddir=$dir/build
603
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
18 booketex=$builddir/dottes.tex
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
19 bookepdf=$builddir/dottes.pdf
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
20
603
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
21 papersize=$1
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
22 shift
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
23
266
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
603
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
26 if [ $# -eq 1 ]; then
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
27 bookename=$1
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
28 for item in title subtitle instrument
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
29 do
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
30 rm -f $builddir/$item.txt
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
31 if [ -r $1/$item.txt ]; then
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
32 cp $dir/$1/$item.txt $builddir/$item.txt
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
33 else
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
34 touch $builddir/$item.txt
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
35 fi
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
36 done
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
37 else
606
d5357ee6b4b2 Rework makeAll.sh to make multiple Bookes and a Bumper Booke too.
Jim Hague <jim.hague@acm.org>
parents: 603
diff changeset
38 bookename="Bumper"
603
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
39 echo "The Bumper Booke" > $builddir/title.txt
606
d5357ee6b4b2 Rework makeAll.sh to make multiple Bookes and a Bumper Booke too.
Jim Hague <jim.hague@acm.org>
parents: 603
diff changeset
40 echo "The collected Bookes of Dottes" > $builddir/subtitle.txt
603
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
41 rm -f $builddir/instrument.txt
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
42 if [ -r $1/instrument.txt ]; then
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
43 cp $1/instrument.txt $builddir/instrument.txt
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
44 else
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
45 touch $builddir/instrument.txt
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
46 fi
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
47 fi
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
48
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
49 cp dottes.tex $builddir
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
50 cp buildno.txt $builddir
304
9c5cabaabbec Replace buzzard EPS with cropped PDF.
Jim Hague <jim.hague@acm.org>
parents: 266
diff changeset
51 cp buzzard.pdf $builddir
603
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
52
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
53 rm -f $builddir/tunes.tex
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
54 rm -f $builddir/firstlines.tex
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
55
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
56 while [ $# -gt 0 ]
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
57 do
603
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
58 section=$dir/$1
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
59
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
60 for item in title subtitle instrument
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
61 do
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
62 rm -f $builddir/$1-$item.txt
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
63 if [ -r $section/$item.txt ]; then
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
64 cp $section/$item.txt $builddir/$1-$item.txt
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
65 else
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
66 touch $builddir/$1-$item.txt
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
67 fi
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
68 done
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
69 for item in intro
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
70 do
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
71 rm -f $builddir/$1-$item.tex
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
72 if [ -r $section/$item.md ]; then
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
73 pandoc --from=markdown --to=latex --output=$builddir/$1-$item.tex $section/$item.md
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
74 else
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
75 touch $builddir/$1-$item.tex
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
76 fi
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
77 done
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
78
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
79 sed -e "s/@SECTION@/$1/" dottes.tex.section-tunes >> $builddir/tunes.tex
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
80 sed -e "s/@SECTION@/$1/" dottes.tex.section-firstlines >> $builddir/firstlines.tex
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
81
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
82 shift
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
83 done
601
507d853433ef Create a section title page in the print version.
Jim Hague <jim.hague@acm.org>
parents: 582
diff changeset
84
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
85 for filename in $dir/*.${papersize}.tex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
86 do
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
87 name=`basename $filename .${papersize}.tex`
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
88 cp $filename $builddir/$name.tex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
89 done
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
90
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
91 cd $builddir
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
92
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
93 xelatex $booketex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
94 xelatex $booketex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
95 xelatex $booketex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
96
603
ef0d66742e01 Revise build to allow multi-section books.
Jim Hague <jim.hague@acm.org>
parents: 602
diff changeset
97 mv $bookepdf $dir/$bookename-${papersize}.pdf
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
98
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
99 cd $dir