comparison makeWeb.sh @ 229:1e4443d58177

Modify Change tune handling. Change all change notes to reference the filename of the tune to change to. Modify web and document generators to pull the change note out of the abc and generate an appropiate bit of content. This is now, in both cases, a hyperlink. In the process, remove the tune-specific .tex facility. It wasn't being used. I could really do with a proper templating system, and using some sort of templating in the LaTeX generation.
author Jim Hague <jim.hague@acm.org>
date Sat, 23 Feb 2013 13:10:58 +0000
parents 0ef955669a9a
children c61e76799e51
comparison
equal deleted inserted replaced
228:129f92df03b5 229:1e4443d58177
1 #!/bin/bash 1 #!/bin/bash
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
7 #set -x
8
9 # Restore titles like 'Exploding Potato, The' to the
10 # expected 'The Exploding Potato'.
11 fixtitle()
12 {
13 retval=`echo "$1" | sed -e "s/\(.*\), *\(.*\)/\2 \1/"`
14 }
6 15
7 if [ $# -lt 2 -o $# -gt 3 ]; then 16 if [ $# -lt 2 -o $# -gt 3 ]; then
8 echo "Usage: makeWeb.sh <book dir name> <master book dir name> [<instrument name>]" 17 echo "Usage: makeWeb.sh <book dir name> <master book dir name> [<instrument name>]"
9 exit 1 18 exit 1
10 fi 19 fi
29 if [ -r $bookedir/intro.txt ]; then 38 if [ -r $bookedir/intro.txt ]; then
30 intro=`cat $bookedir/intro.txt` 39 intro=`cat $bookedir/intro.txt`
31 fi 40 fi
32 41
33 if [ -n "$instrument" ]; then 42 if [ -n "$instrument" ]; then
34 # Remove any transposition tag from title.
35 title="${title} ($instrument)" 43 title="${title} ($instrument)"
36 subtitle="${subtitle} ($instrument)" 44 subtitle="${subtitle} ($instrument)"
37 fi 45 fi
38 46
39 mkdir -p $webdir 47 mkdir -p $webdir
48 56
49 # Now, for each tune, make the tune graphic and sound. 57 # Now, for each tune, make the tune graphic and sound.
50 find $bookedir -name "*.abc" | sort | 58 find $bookedir -name "*.abc" | sort |
51 while read filename 59 while read filename
52 do 60 do
53 title=`$dir/abcfield.py --field T --html $filename`
54 name=`basename $filename .abc` 61 name=`basename $filename .abc`
55 62
56 # Restore titles like 'Exploding Potato, The' to the 63 title=`$dir/abcfield.py --field T --html $filename`
57 # expected 'The Exploding Potato'. 64 fixtitle "$title"
58 title=`echo $title | sed -e "s/\(.*\), *\(.*\)/\2 \1/"` 65 title=$retval
66 changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"`
67 changetitle=""
68 changevisibility="no"
69 if [ -n "$changefile" ]; then
70 changetitle=`$dir/abcfield.py --field T --html $bookedir/$changefile`
71 changevisibility="yes"
72
73 fixtitle "$changetitle"
74 changetitle=$retval
75 fi
59 76
60 # Copy tune PDF from common graphics. 77 # Copy tune PDF from common graphics.
61 cp $graphicsdir/${name}.pdf $webdir 78 cp $graphicsdir/${name}.pdf $webdir
62 79
63 # And copy the ABC. 80 # And copy the ABC.
68 85
69 # If the title contains HTML character entities, escape 86 # If the title contains HTML character entities, escape
70 # initial '&' in the title - it means things to sed. 87 # initial '&' in the title - it means things to sed.
71 sed -e "s/@TITLE@/${title//&/\&}/" \ 88 sed -e "s/@TITLE@/${title//&/\&}/" \
72 -e "s/@MASTERBOOKE@/${masterbooke}/" \ 89 -e "s/@MASTERBOOKE@/${masterbooke}/" \
90 -e "s/@CHANGETITLE@/${changetitle//&/\&}/" \
91 -e "s/@CHANGETUNE@/${changefile/.abc/.html}/" \
92 -e "s/@CHANGEVISIBILITY@/${changevisibility}/" \
73 -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage 93 -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage
74 94
75 sed -e "s/@TITLE@/${title//&/\&}/" \ 95 sed -e "s/@TITLE@/${title//&/\&}/" \
76 -e "s/@TUNE@/${name}/" dottes.html.tuneindex >> $webdir/$output 96 -e "s/@TUNE@/${name}/" dottes.html.tuneindex >> $webdir/$output
77 done 97 done