diff makeBookeA5.sh @ 229:1e4443d58177

Modify Change tune handling. Change all change notes to reference the filename of the tune to change to. Modify web and document generators to pull the change note out of the abc and generate an appropiate bit of content. This is now, in both cases, a hyperlink. In the process, remove the tune-specific .tex facility. It wasn't being used. I could really do with a proper templating system, and using some sort of templating in the LaTeX generation.
author Jim Hague <jim.hague@acm.org>
date Sat, 23 Feb 2013 13:10:58 +0000
parents 6a0bdabfb255
children 440172d9f5d6
line wrap: on
line diff
--- a/makeBookeA5.sh	Sat Feb 23 11:38:35 2013 +0000
+++ b/makeBookeA5.sh	Sat Feb 23 13:10:58 2013 +0000
@@ -7,6 +7,13 @@
 # makeGraphics.sh to make these.
 #
 
+# Restore titles like 'Exploding Potato, The' to the
+# expected 'The Exploding Potato'.
+fixtitle()
+{
+    retval=`echo "$1" | sed -e "s/\(.*\), *\(.*\)/\2 \1/"`
+}
+
 if [ $# != 1 ]; then
     echo "Usage: makeBookeA5.sh <book dir name>"
     exit 1
@@ -43,17 +50,26 @@
 find $booke -name "*.abc" | sort |
     while read filename
     do
+        name=`basename $filename .abc`
         title=`$dir/abcfield.py --field T --latex $filename`
-        name=`basename $filename .abc`
+        fixtitle "$title"
+        title=$retval
+
         echo -E "\newpage" >> $builddir/$output
         echo -E "\begin{center}" >> $builddir/$output
         echo -E "\phantomsection" >> $builddir/$output
-        echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,height=0.9\textheight,keepaspectratio]{$graphicsdir/$name}}" >> $builddir/$output
+        echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,height=0.85\textheight,keepaspectratio]{$graphicsdir/$name}}" >> $builddir/$output
         echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output
         echo -E "\end{center}" >> $builddir/$output
-        text=$booke/$name.tex
-        if [ -r $text ]; then
-            cat $text >> $builddir/$output
+
+        changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"`
+        changetitle=""
+        if [ -n "$changefile" ]; then
+            changetitle=`$dir/abcfield.py --field T --latex $booke/$changefile`
+            fixtitle "$changetitle"
+            changetitle=$retval
+            changename=`basename $changefile .abc`
+            echo -E "Change: \hyperlink{$changename}{$changetitle}" >> $builddir/$output
         fi
     done
 
@@ -62,8 +78,10 @@
 find $booke -name "*.abc" | sort |
     while read filename
     do
+        name=`basename $filename .abc`
         title=`$dir/abcfield.py --field T --latex $filename`
-        name=`basename $filename .abc`
+        fixtitle "$title"
+        title=$retval
         echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output
     done