Mercurial > dottes
comparison 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 |
comparison
equal
deleted
inserted
replaced
42:0e7d2830cb8b | 43:d92717f8130c |
---|---|
1 #!/bin/bash | |
2 # | |
3 # Build the website. The common items and the web items are assumed | |
4 # to be already built. | |
5 # | |
6 | |
7 if [ $# != 1 ]; then | |
8 echo "Usage: makeWeb.sh <book dir name>" | |
9 exit 1 | |
10 fi | |
11 | |
12 dir=`pwd` | |
13 | |
14 booke=$dir/$1 | |
15 webdir=$dir/web/$1 | |
16 graphicsdir=$dir/graphics/$1 | |
17 output=index.html | |
18 | |
19 buildno=`cat buildno.txt` | |
20 subtitle= | |
21 intro= | |
22 if [ -r $booke/subtitle.txt ]; then | |
23 subtitle=`cat $booke/subtitle.txt` | |
24 fi | |
25 if [ -r $booke/intro.txt ]; then | |
26 intro=`cat $booke/intro.txt` | |
27 fi | |
28 | |
29 mkdir -p $webdir | |
30 | |
31 sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \ | |
32 -e "s/@INTRO@/$intro/" -e "s/@BOOK@/$1/" dottes.html.header > $webdir/$output | |
33 | |
34 # Now, for each tune, make the tune graphic and sound. | |
35 find $booke -name "*.abc" | sort | | |
36 while read filename | |
37 do | |
38 title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"` | |
39 name=`basename $filename .abc` | |
40 | |
41 # Copy tune PDF from common graphics. | |
42 cp $graphicsdir/${name}.pdf $webdir | |
43 | |
44 # And copy the ABC. | |
45 cp $filename $webdir | |
46 | |
47 echo "<tr>" >> $webdir/$output | |
48 echo "<td>${title}</td>" >> $webdir/$output | |
49 echo "<td><a href=\"${name}.jpg\">JPG</a></td>" >> $webdir/$output | |
50 echo "<td><a href=\"${name}.pdf\">PDF</a></td>" >> $webdir/$output | |
51 echo "<td><a href=\"${name}.mid\">MIDI</a></td>" >> $webdir/$output | |
52 echo "<td><a href=\"${name}.mp3\">MP3</a></td>" >> $webdir/$output | |
53 echo "<td><a href=\"${name}.abc\">ABC</a></td>" >> $webdir/$output | |
54 echo "</tr>" >> $webdir/$output | |
55 done | |
56 | |
57 cat dottes.html.footer >> $webdir/$output |