2013-06-26 23:37:45 +01:00
|
|
|
#!/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.
|
|
|
|
#
|
|
|
|
|
2016-11-04 17:59:10 +00:00
|
|
|
if [ $# -lt 2 ]; then
|
|
|
|
echo "Usage: makeBooke.sh <A4|A5> <book dir name> [<book dir name>...]"
|
2013-06-26 23:37:45 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
dir=`pwd`
|
|
|
|
|
|
|
|
builddir=$dir/build
|
2016-11-04 17:59:10 +00:00
|
|
|
booketex=$builddir/dottes.tex
|
2013-06-26 23:37:45 +01:00
|
|
|
bookepdf=$builddir/dottes.pdf
|
|
|
|
|
2016-11-04 17:59:10 +00:00
|
|
|
papersize=$1
|
|
|
|
shift
|
|
|
|
|
2013-06-26 23:37:45 +01:00
|
|
|
mkdir -p $builddir
|
|
|
|
|
2016-11-04 17:59:10 +00:00
|
|
|
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="BumperBooke"
|
|
|
|
echo "The Bumper Booke" > $builddir/title.txt
|
|
|
|
echo "The collected Bookes of Bottes" > $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
|
|
|
|
|
2013-06-26 23:37:45 +01:00
|
|
|
cp dottes.tex $builddir
|
|
|
|
cp buildno.txt $builddir
|
2013-07-07 20:29:10 +01:00
|
|
|
cp buzzard.pdf $builddir
|
2016-11-04 17:59:10 +00:00
|
|
|
|
|
|
|
rm -f $builddir/tunes.tex
|
|
|
|
rm -f $builddir/firstlines.tex
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]
|
2013-08-21 10:28:10 +01:00
|
|
|
do
|
2016-11-04 17:59:10 +00:00
|
|
|
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
|
2013-06-26 23:37:45 +01:00
|
|
|
|
2016-11-04 17:59:10 +00:00
|
|
|
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
|
2016-11-04 00:03:54 +00:00
|
|
|
|
2013-06-26 23:37:45 +01:00
|
|
|
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
|
|
|
|
|
2016-11-04 17:59:10 +00:00
|
|
|
mv $bookepdf $dir/$bookename-${papersize}.pdf
|
2013-06-26 23:37:45 +01:00
|
|
|
|
|
|
|
cd $dir
|