From 6c091c1470c7985cc3cd0792df325cd63de97067 Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Sat, 23 Feb 2013 13:10:58 +0000 Subject: [PATCH] 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. --- Session/ALaModeDeFrance.abc | 2 +- Session/BonnyKate.abc | 2 +- Session/CaptainRock.abc | 2 +- Session/ElizabethClare.abc | 3 +-- Session/ExplodingPotato.abc | 2 +- Session/GrandfathersTune.abc | 2 +- Session/HarpersFrolick.abc | 2 +- Session/JustAsTheTideWasFlowing.abc | 3 +-- Session/KingOfTheFairies.abc | 2 +- Session/Laride6.abc | 2 +- Session/MazurkaDeLapleau.abc | 2 +- Session/PlaneTree.abc | 2 +- Session/RoguesMarch.abc | 3 +-- Session/SheriffsRide.abc | 2 +- Session/WillsWay.abc | 2 +- Session/WinsterGallop.abc | 2 +- dottes.html.tune | 5 +++++ makeBookeA4.sh | 28 ++++++++++++++++++++++----- makeBookeA5.sh | 30 +++++++++++++++++++++++------ makeWeb.sh | 30 ++++++++++++++++++++++++----- singletune.fmt | 5 +++-- web/css/dottes.css | 15 +++++++++++++++ 22 files changed, 111 insertions(+), 37 deletions(-) diff --git a/Session/ALaModeDeFrance.abc b/Session/ALaModeDeFrance.abc index 3c94fe5..f77f16a 100644 --- a/Session/ALaModeDeFrance.abc +++ b/Session/ALaModeDeFrance.abc @@ -1,7 +1,7 @@ X: 1 T: A La Mode de France T: Nonesuch -N: Change: Rufty Tufty +N: Change: RuftyTufty.abc M: C L: 1/4 K: Gmaj diff --git a/Session/BonnyKate.abc b/Session/BonnyKate.abc index dbe31ea..d58f53b 100644 --- a/Session/BonnyKate.abc +++ b/Session/BonnyKate.abc @@ -1,7 +1,7 @@ X: 1 T: Bonny Kate M: C -N: Change: Harper's Frolick +N: Change: HarpersFrolick.abc L: 1/4 K: G d e f | "G" g>f g>f | "G" g d d B | "C" c/d/ e d>c |\ diff --git a/Session/CaptainRock.abc b/Session/CaptainRock.abc index ccb3053..02a69dd 100644 --- a/Session/CaptainRock.abc +++ b/Session/CaptainRock.abc @@ -1,6 +1,6 @@ X: 1 T: Captain Rock's Farewell -N: Change: Orange in Bloom +N: Change: OrangeInBloom.abc M: 3/4 L: 1/4 K: Gmaj diff --git a/Session/ElizabethClare.abc b/Session/ElizabethClare.abc index 42f7810..9759a93 100644 --- a/Session/ElizabethClare.abc +++ b/Session/ElizabethClare.abc @@ -1,7 +1,7 @@ X: 1 T: Elizabeth Clare C: Chris Wood -N: Change: Michael Turner's Waltz +N: Change: MichaelTurnersWaltz.abc M: 3/4 L: 1/8 R: waltz @@ -14,4 +14,3 @@ K: Gmaj "C" c2 cd c2 | "G" B2 Bc B2 | "Am" A2 G2 E2 | "D" D2>D2 GA | "G" B2 Bc B2 | "D" A2 AB A2 | "C" G2 E2 GE |\ "G" D2>D2 GA | "G" B2 d2 e2 | d2 c2 B2 | "D" A2 G2 F2 | "G" G3 :| - diff --git a/Session/ExplodingPotato.abc b/Session/ExplodingPotato.abc index 1f0a36b..9edacef 100644 --- a/Session/ExplodingPotato.abc +++ b/Session/ExplodingPotato.abc @@ -1,7 +1,7 @@ X: 1 T: Exploding Potato, The C: Ed Pritchard -N: Change: The Extension Reel +N: Change: ExtensionReel.abc M: C L: 1/4 K: Gmaj diff --git a/Session/GrandfathersTune.abc b/Session/GrandfathersTune.abc index 3e59aca..9b1b3b7 100644 --- a/Session/GrandfathersTune.abc +++ b/Session/GrandfathersTune.abc @@ -1,7 +1,7 @@ X:1 T:Grandfather's Tune S:Nick Barber -N:Change: The Sloe +N:Change: Sloe.abc R:Reel M:4/4 Q:160 diff --git a/Session/HarpersFrolick.abc b/Session/HarpersFrolick.abc index aecd9ec..c51e057 100644 --- a/Session/HarpersFrolick.abc +++ b/Session/HarpersFrolick.abc @@ -2,7 +2,7 @@ X:102 T:Harper's Frolick S:Nick Barber R:Polka -N:Change: Three Around Three +N:Change: ThreeAroundThree.abc M:4/4 L:1/4 Q:160 diff --git a/Session/JustAsTheTideWasFlowing.abc b/Session/JustAsTheTideWasFlowing.abc index 7db7cc9..7f712be 100644 --- a/Session/JustAsTheTideWasFlowing.abc +++ b/Session/JustAsTheTideWasFlowing.abc @@ -1,7 +1,7 @@ X:1 T:Just as the tide was flowing S:Nick Barber -N:Change: Rochdale Coconut Dance +N:Change: RochdaleCoconutDance.abc L:1/4 Q:160 M:C @@ -16,4 +16,3 @@ P:B "G" d B B/A/G/A/ | "Em" B/A/G/F/ "C" E "D" D | "G" G G "C" E "D" D | "G" G G "D" A G/A/ |\ "G" B B "D" c/B/A/G/ | "C" E "D" F "G" G :| - diff --git a/Session/KingOfTheFairies.abc b/Session/KingOfTheFairies.abc index 686e1fc..c614d53 100644 --- a/Session/KingOfTheFairies.abc +++ b/Session/KingOfTheFairies.abc @@ -3,7 +3,7 @@ T: King Of The Fairies M: 4/4 L: 1/8 R: Hornpipe -N: Change: Lanigan's Ball +N: Change: LanigansBall.abc K: Em B,2 |\ |: "Em" (ED)uEvF (GF)vGuA | B2B2 G3 A | B2E2 (EF)GE | "D" (FG)FE D3 B,2 | diff --git a/Session/Laride6.abc b/Session/Laride6.abc index 2292214..3c2c802 100644 --- a/Session/Laride6.abc +++ b/Session/Laride6.abc @@ -2,7 +2,7 @@ X:1 T:Laride 6 M:2/2 L:1/4 -N: Change: Bear Dance +N: Change: BearDance.abc O:France A:Bretagne K:G diff --git a/Session/MazurkaDeLapleau.abc b/Session/MazurkaDeLapleau.abc index 2e5a118..f56d85e 100644 --- a/Session/MazurkaDeLapleau.abc +++ b/Session/MazurkaDeLapleau.abc @@ -1,6 +1,6 @@ X: 6 T:Mazurka de Lapleau -N: Change: Mazurka d'Avignon +N: Change: MazurkaAvignon.abc M:3/4 L:1/8 K:G diff --git a/Session/PlaneTree.abc b/Session/PlaneTree.abc index 467f420..5fb105b 100644 --- a/Session/PlaneTree.abc +++ b/Session/PlaneTree.abc @@ -2,7 +2,7 @@ X: 1 T: Plane Tree, The C: Undine Hornby S: Nick Barber -N: Change: Herbert the Sherbert +N: Change: HerbertTheSherbert.abc M: 6/8 L: 1/8 R: jig diff --git a/Session/RoguesMarch.abc b/Session/RoguesMarch.abc index 6c34b37..7c71aa1 100644 --- a/Session/RoguesMarch.abc +++ b/Session/RoguesMarch.abc @@ -3,10 +3,9 @@ T: Rogues' March M: 6/8 L: 1/4 K: Gmaj -N: Change: Captain Lanoe's Quick March +N: Change: CaptainLanoesQuickMarch.abc "G" B B/ B/c/d/ | "C" e e
+

@TITLE@

@TITLE@ dots +
+ Change: @CHANGETITLE@ +
  • PDF
  • diff --git a/makeBookeA4.sh b/makeBookeA4.sh index 8c4d2a4..1eb9abd 100755 --- a/makeBookeA4.sh +++ b/makeBookeA4.sh @@ -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: makeBookeA4.sh " exit 1 @@ -41,16 +48,25 @@ cp dottes.tex.a4header $builddir/$output find $booke -name "*.abc" | sort | while read filename do - title=`$dir/abcfield.py --field T --latex $filename` name=`basename $filename .abc` + title=`$dir/abcfield.py --field T --latex $filename` + fixtitle "$title" + title=$retval + echo -E "\begin{center}" >> $builddir/$output echo -E "\phantomsection" >> $builddir/$output echo -E "\hypertarget{$name}{\includegraphics[width=\textwidth,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 @@ -59,8 +75,10 @@ cat dottes.tex.firstlines >> $builddir/$output find $booke -name "*.abc" | sort | while read filename do - title=`$dir/abcfield.py --field T --latex $filename` name=`basename $filename .abc` + title=`$dir/abcfield.py --field T --latex $filename` + fixtitle "$title" + title=$retval echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output done diff --git a/makeBookeA5.sh b/makeBookeA5.sh index 9bab335..17056b4 100755 --- a/makeBookeA5.sh +++ b/makeBookeA5.sh @@ -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 " exit 1 @@ -43,17 +50,26 @@ cp dottes.tex.a5header $builddir/$output find $booke -name "*.abc" | sort | while read filename do - title=`$dir/abcfield.py --field T --latex $filename` name=`basename $filename .abc` + title=`$dir/abcfield.py --field T --latex $filename` + 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 @@ cat dottes.tex.firstlines >> $builddir/$output find $booke -name "*.abc" | sort | while read filename do - title=`$dir/abcfield.py --field T --latex $filename` name=`basename $filename .abc` + title=`$dir/abcfield.py --field T --latex $filename` + fixtitle "$title" + title=$retval echo -E "\hyperlink{$name}{$title} & \raisebox{-.25\height}{\includegraphics[width=0.6\textwidth]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output done diff --git a/makeWeb.sh b/makeWeb.sh index 0697791..0bbf17d 100755 --- a/makeWeb.sh +++ b/makeWeb.sh @@ -4,6 +4,15 @@ # to be already built. # +#set -x + +# Restore titles like 'Exploding Potato, The' to the +# expected 'The Exploding Potato'. +fixtitle() +{ + retval=`echo "$1" | sed -e "s/\(.*\), *\(.*\)/\2 \1/"` +} + if [ $# -lt 2 -o $# -gt 3 ]; then echo "Usage: makeWeb.sh []" exit 1 @@ -31,7 +40,6 @@ if [ -r $bookedir/intro.txt ]; then fi if [ -n "$instrument" ]; then - # Remove any transposition tag from title. title="${title} ($instrument)" subtitle="${subtitle} ($instrument)" fi @@ -50,12 +58,21 @@ cp $1-*.pdf $webdir find $bookedir -name "*.abc" | sort | while read filename do - title=`$dir/abcfield.py --field T --html $filename` name=`basename $filename .abc` - # Restore titles like 'Exploding Potato, The' to the - # expected 'The Exploding Potato'. - title=`echo $title | sed -e "s/\(.*\), *\(.*\)/\2 \1/"` + title=`$dir/abcfield.py --field T --html $filename` + fixtitle "$title" + title=$retval + changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"` + changetitle="" + changevisibility="no" + if [ -n "$changefile" ]; then + changetitle=`$dir/abcfield.py --field T --html $bookedir/$changefile` + changevisibility="yes" + + fixtitle "$changetitle" + changetitle=$retval + fi # Copy tune PDF from common graphics. cp $graphicsdir/${name}.pdf $webdir @@ -70,6 +87,9 @@ find $bookedir -name "*.abc" | sort | # initial '&' in the title - it means things to sed. sed -e "s/@TITLE@/${title//&/\&}/" \ -e "s/@MASTERBOOKE@/${masterbooke}/" \ + -e "s/@CHANGETITLE@/${changetitle//&/\&}/" \ + -e "s/@CHANGETUNE@/${changefile/.abc/.html}/" \ + -e "s/@CHANGEVISIBILITY@/${changevisibility}/" \ -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage sed -e "s/@TITLE@/${title//&/\&}/" \ diff --git a/singletune.fmt b/singletune.fmt index 9d19f36..29e6ae2 100644 --- a/singletune.fmt +++ b/singletune.fmt @@ -8,13 +8,14 @@ scale 0.9 titleformat T0 C1 titlespace 0 topspace 0 -% I only want to include Notes in the tune graphics. To turn off the -% other fields, give a blank infoname for that letter. +% I don't want any info fields in the graphics. To turn off the +% fields, give a blank infoname for that letter. infoname S infoname R infoname B infoname D infoname Z infoname H +infoname N infoline true writehistory true diff --git a/web/css/dottes.css b/web/css/dottes.css index 0917684..a671bdc 100644 --- a/web/css/dottes.css +++ b/web/css/dottes.css @@ -180,3 +180,18 @@ div.dottes-tune-list-item-image display: table-cell; vertical-align: middle; } + +div.dottes-change-no +{ + display: none; +} + +div.dottes-change-yes +{ + display: block; + margin: 10px; +} + +div.dottes-change-link +{ +}