diff makeWeb.sh @ 586:daa3b76bd11f

More abcfield.py updates and mark it Python 3. - Move title fixups into Python. - Move key display name expansion into Python. - Add Dottes-specific header continuation line format. None of the usual tools appears to support the official +: continuation.
author Jim Hague <jim.hague@acm.org>
date Mon, 31 Oct 2016 23:48:45 +0000
parents 0206ab9fd6ba
children afc031477784
line wrap: on
line diff
--- a/makeWeb.sh	Mon Oct 31 23:45:00 2016 +0000
+++ b/makeWeb.sh	Mon Oct 31 23:48:45 2016 +0000
@@ -7,44 +7,6 @@
 
 #set -x
 
-# Restore titles like 'Exploding Potato, The' to the
-# expected 'The Exploding Potato'.
-fixtitle()
-{
-    retval=`echo "$1" | sed -e "s/\(.*\), *\(.*\)/\2 \1/"`
-}
-
-# Format a key in ABC (G, Gmin, etc.) in standard presentation format.
-fixkey()
-{
-    letter=${1:0:1}
-    accidental=${1:1:1}
-    if [ "$accidental" != "#" -a "$accidental" != "b" ]; then
-        accidental=""
-        mode=${1:1:3}
-    else
-        mode=${1:2:3}
-    fi
-    mode=${mode,,}
-    mode=${mode/ //g}
-    if [ "$mode" = "m" -o "$mode" = "min" ]; then
-        mode="Minor"
-    elif [ "$mode" = "mix" ]; then
-        mode="Mixolydian"
-    elif [ "$mode" = "dor" ]; then
-        mode="Dorian"
-    elif [ "$mode" = "phr" ]; then
-        mode="Phrygian"
-    elif [ "$mode" = "lyd" ]; then
-        mode="Lydian"
-    elif [ "$mode" = "loc" ]; then
-        mode="Locrian"
-    else
-        mode="Major"
-    fi
-    retval="${letter}${accidental} ${mode}"
-}
-
 if [ $# -lt 2 -o $# -gt 3 ]; then
     echo "Usage: makeWeb.sh <book dir name> <master book dir name> [<instrument name>]"
     exit 1
@@ -105,22 +67,15 @@
         name=`basename $filename .abc`
 
         # Extract items to substitute in the web page.
-        title=`$dir/abcfield.py --field T $filename`
-        fixtitle "$title"
-        title=$retval
-        subtitle=`$dir/abcfield.py --index 2 --field T $filename`
-        fixtitle "$subtitle"
-        subtitle=$retval
+        title=`$dir/abcfield.py --field T --display $filename`
+        subtitle=`$dir/abcfield.py --index 2 --field T --display $filename`
         composer=`$dir/abcfield.py --field C  $filename`
         changefile=`$dir/abcfield.py --field N --starts "Change:" $filename`
         changetitle=""
         changevisibility="no"
         if [ -n "$changefile" ]; then
-            changetitle=`$dir/abcfield.py --field T $bookedir/$changefile`
+            changetitle=`$dir/abcfield.py --field T --display $bookedir/$changefile`
             changevisibility="yes"
-
-            fixtitle "$changetitle"
-            changetitle=$retval
         fi
         credit=`$dir/abcfield.py --field N --starts "Credit:" $filename`
         creditvisibility="no"
@@ -128,9 +83,7 @@
             creditvisibility="yes"
         fi
         lastchanged=`hg log --limit 1 --template "{date|shortdate}" $masterbookedir/${name}.abc`
-        key=`$dir/abcfield.py --field K $filename`
-        fixkey $key
-        key=$retval
+        key=`$dir/abcfield.py --field K --display $filename`
 
         # Copy the ABC into the web.
         cp $filename $webdir