2013-06-26 23:37:45 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Generate the LaTeX for the Booke tune pages (tunes.tex) and the index
|
|
|
|
# of first lines (firstlines.tex). These are generated into the build
|
|
|
|
# directory.
|
|
|
|
#
|
|
|
|
# All EPS and PDF tune graphics must be present already. Run
|
|
|
|
# makeGraphics.sh to make these.
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ $# != 1 ]; then
|
|
|
|
echo "Usage: makeBookeTunePages.sh <book dir name>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
dir=`pwd`
|
|
|
|
|
|
|
|
booke=$dir/$1
|
|
|
|
builddir=$dir/build
|
|
|
|
graphicsdir=$dir/graphics/$1
|
|
|
|
tunesoutput=$builddir/tunes.tex
|
|
|
|
indexoutput=$builddir/firstlines.tex
|
|
|
|
|
|
|
|
mkdir -p $builddir
|
|
|
|
|
|
|
|
rm -f $tunesoutput $indexoutput
|
|
|
|
|
|
|
|
# Now, for each tune, make the tune graphic and add it, inside a
|
|
|
|
# centre section, so the document. Then add a TOC entry.
|
|
|
|
find $booke -name "*.abc" | sort |
|
|
|
|
while read filename
|
|
|
|
do
|
|
|
|
name=`basename $filename .abc`
|
2016-10-31 23:48:45 +00:00
|
|
|
title=`$dir/abcfield.py --field T --latex --display $filename`
|
|
|
|
subtitle=`$dir/abcfield.py --index 2 --field T --latex --display $filename`
|
2013-07-16 16:35:07 +01:00
|
|
|
composer=`$dir/abcfield.py --field C --latex $filename`
|
2013-06-26 23:37:45 +01:00
|
|
|
|
2016-10-29 19:32:53 +01:00
|
|
|
changefile=`$dir/abcfield.py --field N --starts "Change:" $filename`
|
2013-07-18 15:37:23 +01:00
|
|
|
changename=""
|
2013-06-26 23:37:45 +01:00
|
|
|
changetitle=""
|
|
|
|
if [ -n "$changefile" ]; then
|
2013-07-18 15:37:23 +01:00
|
|
|
changename=`basename $changefile .abc`
|
2016-10-31 23:48:45 +00:00
|
|
|
changetitle=`$dir/abcfield.py --field T --latex --display $booke/$changefile`
|
2013-06-26 23:37:45 +01:00
|
|
|
fi
|
2013-08-04 22:09:25 +01:00
|
|
|
|
2016-10-29 19:32:53 +01:00
|
|
|
credit=`$dir/abcfield.py --field N --starts "Credit:" $filename`
|
2013-08-04 22:09:25 +01:00
|
|
|
echo -E "\showtune{$name}{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$changename}{$changetitle}{$credit}" >> $tunesoutput
|
2013-06-26 23:37:45 +01:00
|
|
|
|
2013-07-18 15:37:23 +01:00
|
|
|
echo -E "\showfirstline{$name}{$title}{$graphicsdir/firstline-$name}" >> $indexoutput
|
2013-06-26 23:37:45 +01:00
|
|
|
done
|