#!/bin/sh
#
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: makelinkedpages,v 1.1 2004/10/24 09:41:35 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: 2004/10/24 09:41:35 $</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/yvonne/">Overview page</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/yvonne/">Overview page</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: makelinkedpages,v 1.1 2004/10/24 09:41:35 grog Exp $</font>
    </center>

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