comparison 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
comparison
equal deleted inserted replaced
731:bb4aa5799d91 732:c81a1ed21877
91 fi 91 fi
92 92
93 # Get date and time of last change to tune. 93 # Get date and time of last change to tune.
94 lastchanged=`hg log --limit 1 --template "{date|shortdate}" $masterbookedir/${name}.abc` 94 lastchanged=`hg log --limit 1 --template "{date|shortdate}" $masterbookedir/${name}.abc`
95 95
96 # Get previous and next tune page names and titles. 96 # Get previous and next tunes, if available.
97 prevarg=""
97 prevpage="" 98 prevpage=""
98 prevtitle="" 99 nextarg=""
99 prevfulltitle=""
100 nextpage="" 100 nextpage=""
101 nexttitle=""
102 nextfulltitle=""
103 101
104 if [ $i -gt 0 ]; then 102 if [ $i -gt 0 ]; then
105 prev=${filenames[$((i - 1))]} 103 prev=${filenames[$((i - 1))]}
106 prevpage=`basename $prev .abc`.html 104 prevpage=`basename $prev .abc`.html
107 prevtitle=`./abcfield.py --display --field="T" $prev` 105 prevarg="--prev $prev"
108 prevfulltitle=`./abcfield.py --display --field="FT" $prev`
109 fi 106 fi
110 if [ $i -lt $((nofiles - 1)) ]; then 107 if [ $i -lt $((nofiles - 1)) ]; then
111 next=${filenames[$((i + 1))]} 108 next=${filenames[$((i + 1))]}
112 nextpage=`basename $next .abc`.html 109 nextpage=`basename $next .abc`.html
113 nexttitle=`./abcfield.py --display --field="T" $next` 110 nextarg="--next $next"
114 nextfulltitle=`./abcfield.py --display --field="FT" $next`
115 fi 111 fi
116 112
117 # Generate the tune web page. 113 # Generate the tune web page.
118 tunepage=${name}.html 114 tunepage=${name}.html
119 learnerpage=learner-${name}.html 115 learnerpage=learner-${name}.html
120 116
121 $dir/abctemplate.py \ 117 $dir/abctemplate.py \
122 --value "masterbooke=${masterbooke}" \ 118 --value "masterbooke=${masterbooke}" \
123 --value "lastchanged=${lastchanged}" \ 119 --value "lastchanged=${lastchanged}" \
124 --value "prevpage=${prevpage}" \ 120 --value "prevpage=${prevpage}" \
125 --value "prevtitle=${prevtitle}" \
126 --value "prevfulltitle=${prevfulltitle}" \
127 --value "nextpage=${nextpage}" \ 121 --value "nextpage=${nextpage}" \
128 --value "nexttitle=${nexttitle}" \ 122 ${prevarg} ${nextarg} \
129 --value "nextfulltitle=${nextfulltitle}" \ 123 --template dottes.html.tune \
130 --template dottes.html.tune $filename > $webdir/$tunepage 124 $filename > $webdir/$tunepage
131 $dir/abctemplate.py \ 125 $dir/abctemplate.py \
132 --value "masterbooke=${masterbooke}" \ 126 --value "masterbooke=${masterbooke}" \
133 --value "lastchanged=${lastchanged}" \ 127 --value "lastchanged=${lastchanged}" \
134 --value "prevpage=learner-${prevpage}" \ 128 --value "prevpage=${prevpage}" \
135 --value "prevtitle=${prevtitle}" \ 129 --value "nextpage=${nextpage}" \
136 --value "prevfulltitle=${prevfulltitle}" \ 130 ${prevarg} ${nextarg} \
137 --value "nextpage=learner-${nextpage}" \ 131 --template dottes.html.learnertune \
138 --value "nexttitle=${nexttitle}" \ 132 $filename > $webdir/$learnerpage
139 --value "nextfulltitle=${nextfulltitle}" \
140 --template dottes.html.learnertune $filename > $webdir/$learnerpage
141 $dir/abctemplate.py --template dottes.html.tuneindex $filename >> $webdir/$tunelist 133 $dir/abctemplate.py --template dottes.html.tuneindex $filename >> $webdir/$tunelist
142 done 134 done