Mercurial > dottes
diff makeBooke.sh @ 604:3b8a457ea3c9 build-default-243
Automated merge with ssh://hg.cryhavoc.org.uk/dottes
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Fri, 04 Nov 2016 17:59:19 +0000 |
parents | ef0d66742e01 |
children | d5357ee6b4b2 |
line wrap: on
line diff
--- a/makeBooke.sh Wed Nov 02 19:23:16 2016 +0000 +++ b/makeBooke.sh Fri Nov 04 17:59:19 2016 +0000 @@ -7,41 +7,79 @@ # makeBookeTunePages.sh. # -if [ $# != 2 ]; then - echo "Usage: makeBooke.sh <book dir name> <A4|A5>" +if [ $# -lt 2 ]; then + echo "Usage: makeBooke.sh <A4|A5> <book dir name> [<book dir name>...]" exit 1 fi dir=`pwd` -booke=$dir/$1 -papersize=$2 builddir=$dir/build -booketex=$dir/dottes.tex +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="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 + cp dottes.tex $builddir cp buildno.txt $builddir cp buzzard.pdf $builddir -for item in title subtitle instrument + +rm -f $builddir/tunes.tex +rm -f $builddir/firstlines.tex + +while [ $# -gt 0 ] do - rm -f $builddir/$item.txt - if [ -r $booke/$item.txt ]; then - cp $booke/$item.txt $builddir - else - touch $builddir/$item.txt - fi -done -for item in intro -do - rm -f $builddir/$item.tex - if [ -r $booke/$item.md ]; then - pandoc --from=markdown --to=latex --output=$builddir/$item.tex $booke/$item.md - else - touch $builddir/$item.tex - fi + 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 @@ -56,6 +94,6 @@ xelatex $booketex xelatex $booketex -mv $bookepdf $dir/$1-${papersize}.pdf +mv $bookepdf $dir/$bookename-${papersize}.pdf cd $dir