view makeBooke.sh @ 608:b4eb1753c80f

Up the resolution of the web graphics. This will result in increased image size, on the order of 18k->32k, but I'm fed up with the blurriness of the current images. Ideally I'd move to SVG for the web images, but Mick reckons that SVG support on mobile browsers is still limited. Suspect he's probably right.
author Jim Hague <jim.hague@acm.org>
date Fri, 04 Nov 2016 23:31:40 +0000
parents d5357ee6b4b2
children 7ad6c0aa958d
line wrap: on
line source

#!/bin/bash
#
# Build the Booke. Move subfiles into place and build the Booke into a PDF.
#
# The Booke tune content and all EPS and PDF tune graphics must be
# present already. Run makeGraphics.sh first and then
# makeBookeTunePages.sh.
#

if [ $# -lt 2 ]; then
    echo "Usage: makeBooke.sh <A4|A5> <book dir name> [<book dir name>...]"
    exit 1
fi

dir=`pwd`

builddir=$dir/build
booketex=$builddir/dottes.tex
bookepdf=$builddir/dottes.pdf

papersize=$1
shift

mkdir -p $builddir

if [ $# -eq 1 ]; then
    bookename=$1
    for item in title subtitle instrument
    do
        rm -f $builddir/$item.txt
        if [ -r $1/$item.txt ]; then
            cp $dir/$1/$item.txt $builddir/$item.txt
        else
            touch $builddir/$item.txt
        fi
    done
else
    bookename="Bumper"
    echo "The Bumper Booke" > $builddir/title.txt
    echo "The collected Bookes of Dottes" > $builddir/subtitle.txt
    rm -f $builddir/instrument.txt
    if [ -r $1/instrument.txt ]; then
        cp $1/instrument.txt $builddir/instrument.txt
    else
        touch $builddir/instrument.txt
    fi
fi

cp dottes.tex $builddir
cp buildno.txt $builddir
cp buzzard.pdf $builddir

rm -f $builddir/tunes.tex
rm -f $builddir/firstlines.tex

while [ $# -gt 0 ]
do
    section=$dir/$1

    for item in title subtitle instrument
    do
        rm -f $builddir/$1-$item.txt
        if [ -r $section/$item.txt ]; then
            cp $section/$item.txt $builddir/$1-$item.txt
        else
            touch $builddir/$1-$item.txt
        fi
    done
    for item in intro
    do
        rm -f $builddir/$1-$item.tex
        if [ -r $section/$item.md ]; then
            pandoc --from=markdown --to=latex --output=$builddir/$1-$item.tex $section/$item.md
        else
            touch $builddir/$1-$item.tex
        fi
    done

    sed -e "s/@SECTION@/$1/" dottes.tex.section-tunes >> $builddir/tunes.tex
    sed -e "s/@SECTION@/$1/" dottes.tex.section-firstlines >> $builddir/firstlines.tex

    shift
done

for filename in $dir/*.${papersize}.tex
do
    name=`basename $filename .${papersize}.tex`
    cp $filename $builddir/$name.tex
done

cd $builddir

xelatex $booketex
xelatex $booketex
xelatex $booketex

mv $bookepdf $dir/$bookename-${papersize}.pdf

cd $dir