From c61a2d61369847f2464fa56d07d892b3deca0603 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Fri, 4 Nov 2016 17:59:10 +0000 Subject: [PATCH] Revise build to allow multi-section books. --- dottes.tex | 1 - makeAll.sh | 12 +++---- makeBooke.sh | 89 +++++++++++++++++++++++++++++++++++----------------- 3 files changed, 67 insertions(+), 35 deletions(-) diff --git a/dottes.tex b/dottes.tex index 070cdb7..5b7a9b5 100644 --- a/dottes.tex +++ b/dottes.tex @@ -18,7 +18,6 @@ \usepackage{hyperref} \hypersetup{ - bookmarks=true,% colorlinks=true,% citecolor=black,% filecolor=black,% diff --git a/makeAll.sh b/makeAll.sh index cb6b992..94795b5 100755 --- a/makeAll.sh +++ b/makeAll.sh @@ -11,10 +11,10 @@ makeABooke() { ./makeGraphics.sh "$1" ./makeBookeTunePages.sh "$1" - ./makeBooke.sh "$1" A4 - ./makeBooke.sh "$1" A5 + ./makeBooke.sh A4 "$1" + ./makeBooke.sh A4 "$1" ./makeBooklet.sh "$1" - ./makeBooke.sh "$1" Nook + ./makeBooke.sh Nook "$1" ./makeWebGraphics.sh "$1" ./makeWebAudio.sh "$1" ./makeWeb.sh "$1" "$1" "$2" @@ -24,10 +24,10 @@ makeATransposedBooke() { ./makeGraphics.sh "$1" ./makeBookeTunePages.sh "$1" - ./makeBooke.sh "$1" A4 - ./makeBooke.sh "$1" A5 + ./makeBooke.sh A4 "$1" + ./makeBooke.sh A5 "$1" ./makeBooklet.sh "$1" - ./makeBooke.sh "$1" Nook + ./makeBooke.sh Nook "$1" ./makeWebGraphics.sh "$1" ./makeWeb.sh "$1" "$2" "$3" } diff --git a/makeBooke.sh b/makeBooke.sh index 02af9fc..4d012b6 100755 --- a/makeBooke.sh +++ b/makeBooke.sh @@ -7,47 +7,80 @@ # makeBookeTunePages.sh. # -if [ $# != 2 ]; then - echo "Usage: makeBooke.sh " +if [ $# -lt 2 ]; then + echo "Usage: makeBooke.sh [...]" 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 -do - rm -f $builddir/$item.txt $builddir/$1-$item.txt - if [ -r $booke/$item.txt ]; then - cp $booke/$item.txt $builddir/$item.txt - cp $booke/$item.txt $builddir/$1-$item.txt - else - touch $builddir/$item.txt - touch $builddir/$1-$item.txt - fi -done -for item in intro -do - rm -f $builddir/$1-$item.tex - if [ -r $booke/$item.md ]; then - pandoc --from=markdown --to=latex --output=$builddir/$1-$item.tex $booke/$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 +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 @@ -61,6 +94,6 @@ xelatex $booketex xelatex $booketex xelatex $booketex -mv $bookepdf $dir/$1-${papersize}.pdf +mv $bookepdf $dir/$bookename-${papersize}.pdf cd $dir