#! /bin/csh -f
# Last edited on 1999-04-15 03:18:37 by stolfi

set usage = "$0 [-bgcolor COLOR] FNUM PREV NEXT < EVMTFILE > PAGE.html"

# Reads a page discussion file 
# (a bunch of "#" comments) and formats it as an HTML page.
# Discards non-"#" lines and lines.
# Turns certain lines into headers

set bgcolor = "#ffeedd"

while ( ( $#argv > 0 ) && ( "x$1" =~ x-* ) )
  if ( ( $#argv >= 2 ) && ( "x$1" == "x-bgcolor" ) ) then
    set bgcolor = "$2"; shift; shift;
  else 
    echo 'unrecognized option "'"$1" > /dev/stderr
    echo "usage: ${usage}" > /dev/stderr
  endif
end

if ( $#argv != 3 ) then
  echo "usage: $usage" > /dev/stderr; exit 1
endif

set fnum = "$1"; shift;
set prev = "$1"; shift;
set next = "$1"; shift;

write-html-header \
    -v title="Page ${fnum}" \
    -v wall=eeffee \
    -v text=000000 \
    -v link=0000ff \
    -v seen=770077
    
write-buttons ${prev} ${next}

cat \
  | data-to-html \
      -v exdent=2 \
      -v fnum=${fnum}
  
write-buttons ${prev} ${next}

write-html-tailer
