Mercurial > dottes
comparison 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 |
comparison
equal
deleted
inserted
replaced
196:5b4c478142e1 | 197:8f352063f277 |
---|---|
2 # | 2 # |
3 # Build the website. The common items and the web items are assumed | 3 # Build the website. The common items and the web items are assumed |
4 # to be already built. | 4 # to be already built. |
5 # | 5 # |
6 | 6 |
7 if [ $# != 1 ]; then | 7 if [ $# -lt 1 -o $# -gt 2 ]; then |
8 echo "Usage: makeWeb.sh <book dir name>" | 8 echo "Usage: makeWeb.sh <book dir name> [<instrument name>]" |
9 exit 1 | 9 exit 1 |
10 fi | 10 fi |
11 | 11 |
12 dir=`pwd` | 12 dir=`pwd` |
13 | 13 |
14 booke=$dir/$1 | 14 bookedir=$dir/$1 |
15 webdir=$dir/web/$1 | 15 webdir=$dir/web/$1 |
16 graphicsdir=$dir/graphics/$1 | 16 graphicsdir=$dir/graphics/$1 |
17 output=index.html | 17 output=index.html |
18 title=$1 | |
19 booke=$1 | |
18 | 20 |
19 buildno=`cat buildno.txt` | 21 buildno=`cat buildno.txt` |
20 subtitle= | 22 subtitle= |
21 intro= | 23 intro= |
22 if [ -r $booke/subtitle.txt ]; then | 24 if [ -r $bookedir/subtitle.txt ]; then |
23 subtitle=`cat $booke/subtitle.txt` | 25 subtitle=`cat $bookedir/subtitle.txt` |
24 fi | 26 fi |
25 if [ -r $booke/intro.txt ]; then | 27 if [ -r $bookedir/intro.txt ]; then |
26 intro=`cat $booke/intro.txt` | 28 intro=`cat $bookedir/intro.txt` |
29 fi | |
30 | |
31 if [ -n "$2" ]; then | |
32 title="${title/-.*$//} ($2)" | |
33 subtitle="${subtitle} ($2)" | |
27 fi | 34 fi |
28 | 35 |
29 mkdir -p $webdir | 36 mkdir -p $webdir |
30 | 37 |
31 sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \ | 38 sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \ |
32 -e "s/@INTRO@/$intro/" -e "s/@BOOK@/$1/" dottes.html.header > $webdir/$output | 39 -e "s/@TITLE@/$title/" -e "s/@INTRO@/$intro/" \ |
40 -e "s/@BOOK@/$booke/" dottes.html.header > $webdir/$output | |
33 | 41 |
34 cp $1-*.pdf $webdir | 42 # Copy in the book PDFs. Like the graphics, Midi etc. these are assumed |
43 # to be already generated. | |
44 cp $-*.pdf $webdir | |
35 | 45 |
36 # Now, for each tune, make the tune graphic and sound. | 46 # Now, for each tune, make the tune graphic and sound. |
37 find $booke -name "*.abc" | sort | | 47 find $bookedir -name "*.abc" | sort | |
38 while read filename | 48 while read filename |
39 do | 49 do |
40 title=`$dir/abcfield.py --field T --html $filename` | 50 title=`$dir/abcfield.py --field T --html $filename` |
41 name=`basename $filename .abc` | 51 name=`basename $filename .abc` |
42 | 52 |
44 cp $graphicsdir/${name}.pdf $webdir | 54 cp $graphicsdir/${name}.pdf $webdir |
45 | 55 |
46 # And copy the ABC. | 56 # And copy the ABC. |
47 cp $filename $webdir | 57 cp $filename $webdir |
48 | 58 |
49 echo "<tr>" >> $webdir/$output | 59 # Generate the tune web page. |
50 echo "<td>${title}</td>" >> $webdir/$output | 60 tunepage=${name}.html |
51 echo "<td><a href=\"${name}.png\">PNG</a></td>" >> $webdir/$output | 61 |
52 echo "<td><a href=\"${name}.pdf\">PDF</a></td>" >> $webdir/$output | 62 sed -e "s/@TITLE@/${title}/" \ |
53 echo "<td><a href=\"${name}.mid\">MIDI</a></td>" >> $webdir/$output | 63 -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage |
54 echo "<td><a href=\"${name}.mp3\">MP3</a></td>" >> $webdir/$output | 64 |
55 echo "<td><a href=\"${name}.abc\">ABC</a></td>" >> $webdir/$output | 65 sed -e "s/@TITLE@/${title}/" \ |
56 echo "</tr>" >> $webdir/$output | 66 -e "s/@TUNE@/${name}/" dottes.html.tuneindex >> $webdir/$output |
57 done | 67 done |
58 | 68 |
59 cat dottes.html.footer >> $webdir/$output | 69 cat dottes.html.footer >> $webdir/$output |