annotate makeBookeTunePages.sh @ 906:67c5c18e827c

Have compact and not compact versions of Horse's Brawl.
author Jim Hague <jim.hague@acm.org>
date Tue, 02 Apr 2019 18:32:52 +0100
parents b83b49f2a0a0
children 18f0e45207ef
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 # Generate the LaTeX for the Booke tune pages (tunes.tex) and the index
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
4 # of first lines (firstlines.tex). These are generated into the build
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
5 # directory.
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
6 #
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
7 # All EPS and PDF tune graphics must be present already. Run
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
8 # makeGraphics.sh to make these.
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
748
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
11 usecompact=""
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
12
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
13 if [ $# -gt 1 -a "$1" = "--use-compact" ]; then
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
14 usecompact="yes"
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
15 shift
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
16 fi
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
17
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
18 if [ $# != 1 ]; then
748
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
19 echo "Usage: makeBookeTunePages.sh [--use-compact] <book dir name>"
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
20 exit 1
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
21 fi
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
22
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
23 dir=`pwd`
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
24
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
25 booke=$dir/$1
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
26 builddir=$dir/build
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
27 graphicsdir=$dir/graphics/$1
601
507d853433ef Create a section title page in the print version.
Jim Hague <jim.hague@acm.org>
parents: 588
diff changeset
28 tunesoutput=$builddir/$1-tunes.tex
507d853433ef Create a section title page in the print version.
Jim Hague <jim.hague@acm.org>
parents: 588
diff changeset
29 indexoutput=$builddir/$1-firstlines.tex
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
30
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
31 mkdir -p $builddir
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
32
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
33 rm -f $tunesoutput $indexoutput
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
34
748
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
35 # Now, for each tune, build the tunes part and the first line sections
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
36 # of the document.
753
b83b49f2a0a0 Correct Mac-ism. find -maxdepth n, not find -depth n.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
37 find $booke -maxdepth 1 -name "*.abc" | sort |
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
38 while read filename
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
39 do
748
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
40 name=`basename $filename .abc`
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
41 tuneimagefile="${graphicsdir}/${name}"
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
42 compacttuneimagefile="${graphicsdir}/compact-${name}"
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
43 firstlineimagefile="${graphicsdir}/firstline-${name}"
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
44
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
45 if [ "$usecompact" -a -f ${compacttuneimagefile}.pdf ]; then
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
46 tuneimagefile=$compacttuneimagefile
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
47 fi
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
48
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
49 $dir/abctemplate.py \
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
50 --latex \
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
51 --value "tuneimagefile=${tuneimagefile}" \
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
52 --template $dir/dottes.tex.tune \
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
53 $filename >> $tunesoutput
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
54 $dir/abctemplate.py \
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
55 --latex \
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
56 --value "firstlineimagefile=${firstlineimagefile}" \
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
57 --template $dir/dottes.tex.firstline-tune \
ce5c7214f9aa Introduce mechanism for having different tune images for compact printed output.
Jim Hague <jim.hague@acm.org>
parents: 601
diff changeset
58 $filename >> $indexoutput
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
59 done