Mercurial > dottes
diff makeWeb.sh @ 197:8f352063f277
Finish first version of newly tarted up website.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Sun, 17 Feb 2013 00:27:07 +0000 |
parents | 2fa3c89a0a8a |
children | b8d18ccdc6e4 |
line wrap: on
line diff
--- a/makeWeb.sh Sat Feb 16 23:23:50 2013 +0000 +++ b/makeWeb.sh Sun Feb 17 00:27:07 2013 +0000 @@ -4,37 +4,47 @@ # to be already built. # -if [ $# != 1 ]; then - echo "Usage: makeWeb.sh <book dir name>" +if [ $# -lt 1 -o $# -gt 2 ]; then + echo "Usage: makeWeb.sh <book dir name> [<instrument name>]" exit 1 fi dir=`pwd` -booke=$dir/$1 +bookedir=$dir/$1 webdir=$dir/web/$1 graphicsdir=$dir/graphics/$1 output=index.html +title=$1 +booke=$1 buildno=`cat buildno.txt` subtitle= intro= -if [ -r $booke/subtitle.txt ]; then - subtitle=`cat $booke/subtitle.txt` +if [ -r $bookedir/subtitle.txt ]; then + subtitle=`cat $bookedir/subtitle.txt` fi -if [ -r $booke/intro.txt ]; then - intro=`cat $booke/intro.txt` +if [ -r $bookedir/intro.txt ]; then + intro=`cat $bookedir/intro.txt` +fi + +if [ -n "$2" ]; then + title="${title/-.*$//} ($2)" + subtitle="${subtitle} ($2)" fi mkdir -p $webdir sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \ - -e "s/@INTRO@/$intro/" -e "s/@BOOK@/$1/" dottes.html.header > $webdir/$output + -e "s/@TITLE@/$title/" -e "s/@INTRO@/$intro/" \ + -e "s/@BOOK@/$booke/" dottes.html.header > $webdir/$output -cp $1-*.pdf $webdir +# Copy in the book PDFs. Like the graphics, Midi etc. these are assumed +# to be already generated. +cp $-*.pdf $webdir # Now, for each tune, make the tune graphic and sound. -find $booke -name "*.abc" | sort | +find $bookedir -name "*.abc" | sort | while read filename do title=`$dir/abcfield.py --field T --html $filename` @@ -46,14 +56,14 @@ # And copy the ABC. cp $filename $webdir - echo "<tr>" >> $webdir/$output - echo "<td>${title}</td>" >> $webdir/$output - echo "<td><a href=\"${name}.png\">PNG</a></td>" >> $webdir/$output - echo "<td><a href=\"${name}.pdf\">PDF</a></td>" >> $webdir/$output - echo "<td><a href=\"${name}.mid\">MIDI</a></td>" >> $webdir/$output - echo "<td><a href=\"${name}.mp3\">MP3</a></td>" >> $webdir/$output - echo "<td><a href=\"${name}.abc\">ABC</a></td>" >> $webdir/$output - echo "</tr>" >> $webdir/$output + # Generate the tune web page. + tunepage=${name}.html + + sed -e "s/@TITLE@/${title}/" \ + -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage + + sed -e "s/@TITLE@/${title}/" \ + -e "s/@TUNE@/${name}/" dottes.html.tuneindex >> $webdir/$output done cat dottes.html.footer >> $webdir/$output