Mercurial > dottes
diff makeWeb.sh @ 943:d6e2a281cceb build-default-344
Change web page layout.
Put tune contents under 'tunes/<name>' or 'tunes-<instrument>/<name>'.
That way they won't move if the tune gets moved between Bookes.
For now I have not attempted to redirect old URLs.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Mon, 05 Aug 2019 23:25:28 +0100 |
parents | b83b49f2a0a0 |
children | 0f4ba68d6059 |
line wrap: on
line diff
--- a/makeWeb.sh Mon Aug 05 23:22:04 2019 +0100 +++ b/makeWeb.sh Mon Aug 05 23:25:28 2019 +0100 @@ -18,7 +18,10 @@ masterbooke=$2 bookedir=$dir/$1 masterbookedir=$dir/$2 -webdir=$dir/web/$1 +basewebdir=$dir/web +mastertunedir=tunes +basetunedir=$mastertunedir +bookewebdir=$dir/web/$1 graphicsdir=$dir/graphics/$1 output=index.html tunelist=tunelist.html @@ -38,34 +41,35 @@ if [ -n "$instrument" ]; then title="${title} ($instrument)" subtitle="${subtitle} ($instrument)" + basetunedir="${basetunedir}-${instrument}" fi -mkdir -p $webdir +mkdir -p $bookewebdir sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \ - -e "s/@TITLE@/$title/" -e "s/@BOOK@/$booke/" dottes.html > $webdir/$output + -e "s/@TITLE@/$title/" -e "s/@BOOK@/$booke/" dottes.html > $bookewebdir/$output for item in intro do - rm -f $webdir/$item.html + rm -f $bookewebdir/$item.html if [ -r $bookedir/$item.md ]; then - pandoc --from=markdown --to=html --output=$webdir/$item.html $bookedir/$item.md + pandoc --from=markdown --to=html --output=$bookewebdir/$item.html $bookedir/$item.md else - touch $webdir/$item.html + touch $bookewebdir/$item.html fi done # Copy in any htaccess. if [ -r $masterbookedir/htaccess ]; then - cp $masterbookedir/htaccess $webdir/.htaccess + cp $masterbookedir/htaccess $bookewebdir/.htaccess fi # Copy in the book PDFs. Like the graphics, Midi etc. these are assumed # to be already generated. -cp $1-*.pdf $webdir +cp $1-*.pdf $bookewebdir # Now, for each tune, make the tune page. -rm -f $webdir/$tunelist +rm -f $bookewebdir/$tunelist declare -a filenames filenames=(`find $bookedir -maxdepth 1 -name "*.abc" | sort`) nofiles=${#filenames[@]} @@ -73,22 +77,15 @@ do filename=${filenames[$i]} name=`basename $filename .abc` + tunedir=$basetunedir/$name + tunewebdir=$basewebdir/$tunedir + mkdir -p $tunewebdir # Copy the ABC into the web. - cp $filename $webdir + cp $filename $tunewebdir # Generate MusicXML into the web. - python $abc2xml $filename > ${webdir}/${name}.xml - - # If we are not the master booke, link the mp3s in from the - # master page in a desperate attempt to make IE8 work. - # The Jenkins archive will dereference the soft link, it seems, - # but I guess I can live with copies of the MP3 for now. - if [ "$booke" != "$masterbooke" ]; then - pushd ${webdir} > /dev/null - ln -f -s ../${masterbooke}/*${name}.mp3 . - popd > /dev/null - fi + python $abc2xml $filename > ${tunewebdir}/${name}.xml # Get date and time of last change to tune. lastchanged=`hg log --limit 1 --template "{date|shortdate}" $masterbookedir/${name}.abc` @@ -101,34 +98,35 @@ if [ $i -gt 0 ]; then prev=${filenames[$((i - 1))]} - prevpage=`basename $prev .abc`.html + prevpage=`basename $prev .abc` prevarg="--prev $prev" fi if [ $i -lt $((nofiles - 1)) ]; then next=${filenames[$((i + 1))]} - nextpage=`basename $next .abc`.html + nextpage=`basename $next .abc` nextarg="--next $next" fi # Generate the tune web page. - tunepage=${name}.html - learnerpage=learner-${name}.html - $dir/abctemplate.py \ - --value "masterbooke=${masterbooke}" \ + --value "booke=${booke}" \ + --value "mastertunedir=${mastertunedir}" \ --value "lastchanged=${lastchanged}" \ --value "prevpage=${prevpage}" \ --value "nextpage=${nextpage}" \ ${prevarg} ${nextarg} \ --template dottes.html.tune \ - $filename > $webdir/$tunepage + $filename > $tunewebdir/index.html $dir/abctemplate.py \ - --value "masterbooke=${masterbooke}" \ + --value "booke=${booke}" \ + --value "mastertunedir=${mastertunedir}" \ --value "lastchanged=${lastchanged}" \ --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 + $filename > $tunewebdir/learner.html + $dir/abctemplate.py \ + --value "tunedir=${tunedir}" \ + --template dottes.html.tuneindex $filename >> $bookewebdir/$tunelist done