view makeBookeTunePages.sh @ 849:eb5da4e5c057

Fix up subtitles which have a ', The' form. We no longer fix up such titles other than the primary title. The primary title uses the ", <prefix>" so the sort order can ignore prefixes words like 'The' or 'An'.
author Jim Hague <jim.hague@acm.org>
date Sat, 23 Mar 2019 14:57:19 +0000
parents b83b49f2a0a0
children 18f0e45207ef
line wrap: on
line source

#!/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.
#

usecompact=""

if [ $# -gt 1 -a "$1" = "--use-compact" ]; then
    usecompact="yes"
    shift
fi

if [ $# != 1 ]; then
    echo "Usage: makeBookeTunePages.sh [--use-compact] <book dir name>"
    exit 1
fi

dir=`pwd`

booke=$dir/$1
builddir=$dir/build
graphicsdir=$dir/graphics/$1
tunesoutput=$builddir/$1-tunes.tex
indexoutput=$builddir/$1-firstlines.tex

mkdir -p $builddir

rm -f $tunesoutput $indexoutput

# Now, for each tune, build the tunes part and the first line sections
# of the document.
find $booke -maxdepth 1 -name "*.abc" | sort |
    while read filename
    do
        name=`basename $filename .abc`
        tuneimagefile="${graphicsdir}/${name}"
        compacttuneimagefile="${graphicsdir}/compact-${name}"
        firstlineimagefile="${graphicsdir}/firstline-${name}"

        if [ "$usecompact" -a -f ${compacttuneimagefile}.pdf ]; then
            tuneimagefile=$compacttuneimagefile
        fi

        $dir/abctemplate.py \
            --latex \
            --value "tuneimagefile=${tuneimagefile}" \
            --template $dir/dottes.tex.tune \
            $filename >> $tunesoutput
        $dir/abctemplate.py \
            --latex \
            --value "firstlineimagefile=${firstlineimagefile}" \
            --template $dir/dottes.tex.firstline-tune \
            $filename >> $indexoutput
    done