comparison makeWeb.sh @ 533:36d43edbd3f5

Correct web generation. 1. Subtitle and composer to be HTML not Latex. 2. Fix escaping of & in sed patterns.
author Jim Hague <jim.hague@acm.org>
date Sun, 13 Dec 2015 17:50:23 +0000
parents 4cc739fe13ab
children 760d0ae5acea
comparison
equal deleted inserted replaced
530:b163d8d3f4a7 533:36d43edbd3f5
106 106
107 # Extract items to substitute in the web page. 107 # Extract items to substitute in the web page.
108 title=`$dir/abcfield.py --field T --html $filename` 108 title=`$dir/abcfield.py --field T --html $filename`
109 fixtitle "$title" 109 fixtitle "$title"
110 title=$retval 110 title=$retval
111 subtitle=`$dir/abcfield.py --index 2 --field T --latex $filename` 111 subtitle=`$dir/abcfield.py --index 2 --field T --html $filename`
112 fixtitle "$subtitle" 112 fixtitle "$subtitle"
113 subtitle=$retval 113 subtitle=$retval
114 composer=`$dir/abcfield.py --field C --latex $filename` 114 composer=`$dir/abcfield.py --field C --html $filename`
115 changefile=`$dir/abcfield.py --field N --contains "Change:" $filename | sed -e "s/Change: *//"` 115 changefile=`$dir/abcfield.py --field N --contains "Change:" $filename | sed -e "s/Change: *//"`
116 changetitle="" 116 changetitle=""
117 changevisibility="no" 117 changevisibility="no"
118 if [ -n "$changefile" ]; then 118 if [ -n "$changefile" ]; then
119 changetitle=`$dir/abcfield.py --field T --html $bookedir/$changefile` 119 changetitle=`$dir/abcfield.py --field T --html $bookedir/$changefile`
152 tunepage=${name}.html 152 tunepage=${name}.html
153 learnerpage=learner-${name}.html 153 learnerpage=learner-${name}.html
154 154
155 # If the title contains HTML character entities, escape 155 # If the title contains HTML character entities, escape
156 # initial '&' in the title - it means things to sed. 156 # initial '&' in the title - it means things to sed.
157 sed -e "s/@TITLE@/${title//&/\&}/" \ 157 sed -e "s/@TITLE@/${title//&/\\&}/" \
158 -e "s/@SUBTITLE@/${subtitle}/" \ 158 -e "s/@SUBTITLE@/${subtitle}/" \
159 -e "s/@COMPOSER@/${composer}/" \ 159 -e "s/@COMPOSER@/${composer}/" \
160 -e "s/@KEY@/${key}/" \ 160 -e "s/@KEY@/${key}/" \
161 -e "s/@MASTERBOOKE@/${masterbooke}/" \ 161 -e "s/@MASTERBOOKE@/${masterbooke}/" \
162 -e "s/@CHANGETITLE@/${changetitle//&/\&}/" \ 162 -e "s/@CHANGETITLE@/${changetitle//&/\\&}/" \
163 -e "s/@CHANGETUNE@/${changefile/.abc/.html}/" \ 163 -e "s/@CHANGETUNE@/${changefile/.abc/.html}/" \
164 -e "s/@CHANGEVISIBILITY@/${changevisibility}/" \ 164 -e "s/@CHANGEVISIBILITY@/${changevisibility}/" \
165 -e "s/@CREDIT@/${credit}/" \ 165 -e "s/@CREDIT@/${credit}/" \
166 -e "s/@CREDITVISIBILITY@/${creditvisibility}/" \ 166 -e "s/@CREDITVISIBILITY@/${creditvisibility}/" \
167 -e "s/@LASTCHANGED@/${lastchanged}/" \ 167 -e "s/@LASTCHANGED@/${lastchanged}/" \
168 -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage 168 -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage
169 169
170 sed -e "s/@TITLE@/${title//&/\&}/" \ 170 sed -e "s/@TITLE@/${title//&/\\&}/" \
171 -e "s/@SUBTITLE@/${subtitle}/" \ 171 -e "s/@SUBTITLE@/${subtitle}/" \
172 -e "s/@COMPOSER@/${composer}/" \ 172 -e "s/@COMPOSER@/${composer}/" \
173 -e "s/@KEY@/${key}/" \ 173 -e "s/@KEY@/${key}/" \
174 -e "s/@MASTERBOOKE@/${masterbooke}/" \ 174 -e "s/@MASTERBOOKE@/${masterbooke}/" \
175 -e "s/@CHANGETITLE@/${changetitle//&/\&}/" \ 175 -e "s/@CHANGETITLE@/${changetitle//&/\\&}/" \
176 -e "s/@CHANGETUNE@/${changefile/.abc/.html}/" \ 176 -e "s/@CHANGETUNE@/${changefile/.abc/.html}/" \
177 -e "s/@CHANGEVISIBILITY@/${changevisibility}/" \ 177 -e "s/@CHANGEVISIBILITY@/${changevisibility}/" \
178 -e "s/@CREDIT@/${credit}/" \ 178 -e "s/@CREDIT@/${credit}/" \
179 -e "s/@CREDITVISIBILITY@/${creditvisibility}/" \ 179 -e "s/@CREDITVISIBILITY@/${creditvisibility}/" \
180 -e "s/@LASTCHANGED@/${lastchanged}/" \ 180 -e "s/@LASTCHANGED@/${lastchanged}/" \
181 -e "s/@TUNE@/${name}/" dottes.html.learnertune > $webdir/$learnerpage 181 -e "s/@TUNE@/${name}/" dottes.html.learnertune > $webdir/$learnerpage
182 182
183 sed -e "s/@TITLE@/${title//&/\&}/" \ 183 sed -e "s/@TITLE@/${title//&/\\&}/" \
184 -e "s/@TUNE@/${name}/" dottes.html.tuneindex >> $webdir/$tunelist 184 -e "s/@TUNE@/${name}/" dottes.html.tuneindex >> $webdir/$tunelist
185 done 185 done