diff makeWeb.sh @ 732:c81a1ed21877

Move prev/next field reading into abctemplate.py. Fishing all that stuff out in makeWeb.sh was a bit ugly.
author Jim Hague <jim.hague@acm.org>
date Thu, 12 Oct 2017 11:21:48 +0100
parents 772402f5f8ea
children ce5c7214f9aa
line wrap: on
line diff
--- a/makeWeb.sh	Wed Oct 11 23:14:30 2017 +0100
+++ b/makeWeb.sh	Thu Oct 12 11:21:48 2017 +0100
@@ -93,25 +93,21 @@
     # Get date and time of last change to tune.
     lastchanged=`hg log --limit 1 --template "{date|shortdate}" $masterbookedir/${name}.abc`
 
-    # Get previous and next tune page names and titles.
+    # Get previous and next tunes, if available.
+    prevarg=""
     prevpage=""
-    prevtitle=""
-    prevfulltitle=""
+    nextarg=""
     nextpage=""
-    nexttitle=""
-    nextfulltitle=""
 
     if [ $i -gt 0 ]; then
         prev=${filenames[$((i - 1))]}
         prevpage=`basename $prev .abc`.html
-        prevtitle=`./abcfield.py --display --field="T" $prev`
-        prevfulltitle=`./abcfield.py --display --field="FT" $prev`
+        prevarg="--prev $prev"
     fi
     if [ $i -lt $((nofiles - 1)) ]; then
         next=${filenames[$((i + 1))]}
         nextpage=`basename $next .abc`.html
-        nexttitle=`./abcfield.py --display --field="T" $next`
-        nextfulltitle=`./abcfield.py --display --field="FT" $next`
+        nextarg="--next $next"
     fi
 
     # Generate the tune web page.
@@ -122,21 +118,17 @@
         --value "masterbooke=${masterbooke}" \
         --value "lastchanged=${lastchanged}" \
         --value "prevpage=${prevpage}" \
-        --value "prevtitle=${prevtitle}" \
-        --value "prevfulltitle=${prevfulltitle}" \
         --value "nextpage=${nextpage}" \
-        --value "nexttitle=${nexttitle}" \
-        --value "nextfulltitle=${nextfulltitle}" \
-        --template dottes.html.tune $filename > $webdir/$tunepage
+        ${prevarg} ${nextarg} \
+        --template dottes.html.tune \
+        $filename > $webdir/$tunepage
     $dir/abctemplate.py \
         --value "masterbooke=${masterbooke}" \
         --value "lastchanged=${lastchanged}" \
-        --value "prevpage=learner-${prevpage}" \
-        --value "prevtitle=${prevtitle}" \
-        --value "prevfulltitle=${prevfulltitle}" \
-        --value "nextpage=learner-${nextpage}" \
-        --value "nexttitle=${nexttitle}" \
-        --value "nextfulltitle=${nextfulltitle}" \
-        --template dottes.html.learnertune $filename > $webdir/$learnerpage
+        --value "prevpage=${prevpage}" \
+        --value "nextpage=${nextpage}" \
+        ${prevarg} ${nextarg} \
+        --template dottes.html.learnertune \
+        $filename > $webdir/$learnerpage
     $dir/abctemplate.py --template dottes.html.tuneindex $filename >> $webdir/$tunelist
 done