Use server-side includes (with Apache XBitHack setting) in web.

This means that we can have one main web page, dottes.html, for each
book and include the intro and tunelist to make the page. This removes
the separate header and footer components.

Perhaps we should use a template engine instead to generate the output.
That means choosing one. And preferably one that isn't aimed only at
HTML so we could use it for the printed books. More research required.
This commit is contained in:
Jim Hague 2013-08-21 10:32:50 +01:00
parent ed0ef9ce66
commit 8766830f70
3 changed files with 23 additions and 12 deletions

View File

@ -21,6 +21,7 @@
<div class="grid_12 dottes-body"> <div class="grid_12 dottes-body">
<h1>@SUBTITLE@</h1> <h1>@SUBTITLE@</h1>
<!--#include file="intro.html" -->
<p>@INTRO@ <p>@INTRO@
<p>You can download a PDF with a booklet of these tunes. There is an <p>You can download a PDF with a booklet of these tunes. There is an
<a href="@BOOK@-A5.pdf">A5 landscape book</a> with one <a href="@BOOK@-A5.pdf">A5 landscape book</a> with one
@ -40,3 +41,9 @@
<div class="grid_12 dottes-body"> <div class="grid_12 dottes-body">
<h1>The tunes</h1> <h1>The tunes</h1>
<div class="dottes-tune-list"> <div class="dottes-tune-list">
<!--#include file="tunelist.html" -->
</div>
</div>
</div>
</body>
</html>

View File

@ -1,4 +0,0 @@
</div>
</div>
</body>
</html>

View File

@ -24,6 +24,7 @@ bookedir=$dir/$1
webdir=$dir/web/$1 webdir=$dir/web/$1
graphicsdir=$dir/graphics/$1 graphicsdir=$dir/graphics/$1
output=index.html output=index.html
tunelist=tunelist.html
booke=$1 booke=$1
masterbooke=$2 masterbooke=$2
title=$booke title=$booke
@ -37,9 +38,6 @@ intro=
if [ -r $bookedir/subtitle.txt ]; then if [ -r $bookedir/subtitle.txt ]; then
subtitle=`cat $bookedir/subtitle.txt` subtitle=`cat $bookedir/subtitle.txt`
fi fi
if [ -r $bookedir/intro.txt ]; then
intro=`txt2tags --no-headers --target=html --outfile=- $bookedir/intro.txt`
fi
if [ -n "$instrument" ]; then if [ -n "$instrument" ]; then
title="${title} ($instrument)" title="${title} ($instrument)"
@ -49,8 +47,20 @@ fi
mkdir -p $webdir mkdir -p $webdir
sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \ sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \
-e "s/@TITLE@/$title/" -e "s/@INTRO@/$intro/" \ -e "s/@TITLE@/$title/" -e "s/@BOOK@/$booke/" dottes.html > $webdir/$output
-e "s/@BOOK@/$booke/" dottes.html.header > $webdir/$output
# Mark output as executable so it is scanned for server-side includes.
chmod +x $webdir/$output
for item in intro
do
rm -f $webdir/$item.html
if [ -r $booke/$item.txt ]; then
txt2tags --no-headers --target=html --outfile=$webdir/$item.html $booke/$item.txt
else
touch $webdir/$item.html
fi
done
# Copy in the book PDFs. Like the graphics, Midi etc. these are assumed # Copy in the book PDFs. Like the graphics, Midi etc. these are assumed
# to be already generated. # to be already generated.
@ -103,7 +113,5 @@ find $bookedir -name "*.abc" | sort |
-e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage
sed -e "s/@TITLE@/${title//&/\&}/" \ sed -e "s/@TITLE@/${title//&/\&}/" \
-e "s/@TUNE@/${name}/" dottes.html.tuneindex >> $webdir/$output -e "s/@TUNE@/${name}/" dottes.html.tuneindex >> $webdir/$tunelist
done done
cat dottes.html.footer >> $webdir/$output