#!/bin/sh
#
# $Id: makepages,v 1.3 2010/05/03 00:11:58 grog Exp $
#
# Create "Cuisine de mère Yvonne" index pages.
#
# Usage: . $0 `jot 93 0`
echo $0 $*
PREV=""
while [ $# -gt 0 ]; do
  PAGENO=`echo $1 | sed 's:.jpeg::'`
  NEXT=`echo $2 | sed 's:.jpeg::'`
 echo PAGE $PAGENO NEXT $NEXT
  cat <<EOF > $PAGENO.html
<!-- Hey, emacs!  Edit this file in -*- html-fill -*- mode! -->
<!-- $Id: makepages,v 1.3 2010/05/03 00:11:58 grog Exp $ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <title></title>
  </head>

  <body>
    <center>
      <h1>Yvonne's recipe book, page $PAGENO</h1>
    </center>

    <center>
      <font size="-1">Last update: $Date: 2010/05/03 00:11:58 $</font>
    </center>

    <table summary="footings" width="100%">
      <tr>
EOF

  if [ "$PREV" != "" ]; then
      echo >> $PAGENO.html "<td width="25%"><a href="$PREV.html">Previous page ($PREV)</a></td>"
  fi
      echo >> $PAGENO.html "<td width="25%"><a href="/grog/recipes/mere-yvonne.html">Overview page</a></td>"
      echo >> $PAGENO.html "<td width="25%"><a href="88.html">Index</a></td>"
  if [ "$NEXT" != "" ]; then
      echo >> $PAGENO.html "<td width="25%"><a href="$NEXT.html">Next page ($NEXT)</a></td>"
  fi

  cat <<EOF >> $PAGENO.html
      </tr>
    </table>
   <br/>
   <img alt="Recipe book page $PAGENO" src="$PAGENO.jpeg">
   <br/>
   <hr/>
    <table summary="footings" width="100%">
      <tr>
EOF
  if [ "$PREV" != "" ]; then
      echo >> $PAGENO.html "<td width="25%"><a href="$PREV.html">Previous page ($PREV)</a></td>"
  fi
      echo >> $PAGENO.html "<td width="25%"><a href="/grog/recipes/mere-yvonne.html">Overview page</a></td>"
      echo >> $PAGENO.html "<td width="25%"><a href="88.html">Index</a></td>"
  if [ "$NEXT" != "" ]; then
      echo >> $PAGENO.html "<td width="25%"><a href="$NEXT.html">Next page ($NEXT)</a></td>"
  fi

  cat <<EOF >> $PAGENO.html
      </tr>
    </table>

    <p>
    <a href="http://validator.w3.org/check/referer"><img
    src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31"
    width="88" /></a>

    <center>
      <font size="-1">\$Id: makepages,v 1.3 2010/05/03 00:11:58 grog Exp $</font>
    </center>

  </body>
</html>
EOF
  tidy -m -asxhtml $PAGENO.html
  PREV=$PAGENO
  shift
done
  