annotate makeBookeTunePages.sh @ 586:daa3b76bd11f

More abcfield.py updates and mark it Python 3. - Move title fixups into Python. - Move key display name expansion into Python. - Add Dottes-specific header continuation line format. None of the usual tools appears to support the official +: continuation.
author Jim Hague <jim.hague@acm.org>
date Mon, 31 Oct 2016 23:48:45 +0000
parents 760d0ae5acea
children afc031477784
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
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
11 if [ $# != 1 ]; then
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
12 echo "Usage: makeBookeTunePages.sh <book dir name>"
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
13 exit 1
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
14 fi
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
15
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
16 dir=`pwd`
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
17
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
18 booke=$dir/$1
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 tunesoutput=$builddir/tunes.tex
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
22 indexoutput=$builddir/firstlines.tex
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 rm -f $tunesoutput $indexoutput
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
27
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
28 # Now, for each tune, make the tune graphic and add it, inside a
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
29 # centre section, so the document. Then add a TOC entry.
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
30 find $booke -name "*.abc" | sort |
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
31 while read filename
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
32 do
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
33 name=`basename $filename .abc`
586
daa3b76bd11f More abcfield.py updates and mark it Python 3.
Jim Hague <jim.hague@acm.org>
parents: 581
diff changeset
34 title=`$dir/abcfield.py --field T --latex --display $filename`
daa3b76bd11f More abcfield.py updates and mark it Python 3.
Jim Hague <jim.hague@acm.org>
parents: 581
diff changeset
35 subtitle=`$dir/abcfield.py --index 2 --field T --latex --display $filename`
319
cbe9c10b5a3e Render tune title, subtitle and composer in Latex/HTML and not in the image.
Jim Hague <jim.hague@acm.org>
parents: 312
diff changeset
36 composer=`$dir/abcfield.py --field C --latex $filename`
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
37
581
760d0ae5acea Revise abcfield.py to recognise continuation fields.
Jim Hague <jim.hague@acm.org>
parents: 520
diff changeset
38 changefile=`$dir/abcfield.py --field N --starts "Change:" $filename`
323
1a240d1e2032 Go back to using the filename as the hyperlink name.
Jim Hague <jim.hague@acm.org>
parents: 319
diff changeset
39 changename=""
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
40 changetitle=""
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
41 if [ -n "$changefile" ]; then
323
1a240d1e2032 Go back to using the filename as the hyperlink name.
Jim Hague <jim.hague@acm.org>
parents: 319
diff changeset
42 changename=`basename $changefile .abc`
586
daa3b76bd11f More abcfield.py updates and mark it Python 3.
Jim Hague <jim.hague@acm.org>
parents: 581
diff changeset
43 changetitle=`$dir/abcfield.py --field T --latex --display $booke/$changefile`
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
44 fi
326
27f29e8aafea Add --contains flag to abcfield.py.
Jim Hague <jim.hague@acm.org>
parents: 323
diff changeset
45
581
760d0ae5acea Revise abcfield.py to recognise continuation fields.
Jim Hague <jim.hague@acm.org>
parents: 520
diff changeset
46 credit=`$dir/abcfield.py --field N --starts "Credit:" $filename`
326
27f29e8aafea Add --contains flag to abcfield.py.
Jim Hague <jim.hague@acm.org>
parents: 323
diff changeset
47 echo -E "\showtune{$name}{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$changename}{$changetitle}{$credit}" >> $tunesoutput
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
48
323
1a240d1e2032 Go back to using the filename as the hyperlink name.
Jim Hague <jim.hague@acm.org>
parents: 319
diff changeset
49 echo -E "\showfirstline{$name}{$title}{$graphicsdir/firstline-$name}" >> $indexoutput
266
06e140f48543 Revise scripts for building printed Bookes.
Jim Hague <jim.hague@acm.org>
parents:
diff changeset
50 done