annotate makeWeb.sh @ 43:d92717f8130c

First go at producing a very simple website. Templating done with sed, and minimal HTML.
author Jim Hague <jim.hague@laicatc.com>
date Sun, 04 Mar 2012 12:39:12 +0000
parents
children 689026e2de0c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
1 #!/bin/bash
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
2 #
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
3 # Build the website. The common items and the web items are assumed
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
4 # to be already built.
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
5 #
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
6
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
7 if [ $# != 1 ]; then
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
8 echo "Usage: makeWeb.sh <book dir name>"
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
9 exit 1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
10 fi
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
11
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
12 dir=`pwd`
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
13
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
14 booke=$dir/$1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
15 webdir=$dir/web/$1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
16 graphicsdir=$dir/graphics/$1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
17 output=index.html
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
18
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
19 buildno=`cat buildno.txt`
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
20 subtitle=
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
21 intro=
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
22 if [ -r $booke/subtitle.txt ]; then
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
23 subtitle=`cat $booke/subtitle.txt`
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
24 fi
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
25 if [ -r $booke/intro.txt ]; then
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
26 intro=`cat $booke/intro.txt`
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
27 fi
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
28
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
29 mkdir -p $webdir
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
30
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
31 sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
32 -e "s/@INTRO@/$intro/" -e "s/@BOOK@/$1/" dottes.html.header > $webdir/$output
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
33
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
34 # Now, for each tune, make the tune graphic and sound.
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
35 find $booke -name "*.abc" | sort |
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
36 while read filename
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
37 do
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
38 title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"`
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
39 name=`basename $filename .abc`
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
40
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
41 # Copy tune PDF from common graphics.
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
42 cp $graphicsdir/${name}.pdf $webdir
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
44 # And copy the ABC.
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
45 cp $filename $webdir
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
46
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
47 echo "<tr>" >> $webdir/$output
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
48 echo "<td>${title}</td>" >> $webdir/$output
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
49 echo "<td><a href=\"${name}.jpg\">JPG</a></td>" >> $webdir/$output
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
50 echo "<td><a href=\"${name}.pdf\">PDF</a></td>" >> $webdir/$output
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
51 echo "<td><a href=\"${name}.mid\">MIDI</a></td>" >> $webdir/$output
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
52 echo "<td><a href=\"${name}.mp3\">MP3</a></td>" >> $webdir/$output
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
53 echo "<td><a href=\"${name}.abc\">ABC</a></td>" >> $webdir/$output
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
54 echo "</tr>" >> $webdir/$output
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
55 done
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
56
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
57 cat dottes.html.footer >> $webdir/$output