#!/bin/csh -f
#--------------------------------------------------
# script:  makestyle
# author:  john@december.com
# date:    07 July 1996
# version: 1.0
# purpose: demonstrate file generation in HTML
#          includes XX- replacements
#          and style argument 
# usage:   makestyle filename style "title" "annotation"
#--------------------------------------------------
# Echo the input to announce the script is running
echo "makestyle on" $*
# This is where I'll store the generated file
set GENLOC="../gen"
# This is where I keep the source files
set SRCLOC="../src"
# I grab off the arguments and name them 
set FILE="$1"
set STYLE="$2"
set TITLE="$3"
set ANNOTATE="$4"
set DATE=`date`
set HEADFILE=$STYLE"head.html"
set FOOTFILE=$STYLE"foot.html"
# I start off with the head and replace the XX- strings
cat $SRCLOC/$HEADFILE | sed -e "s/XX-TITLE/$TITLE/g" -e "s/XX-ANNOTATION/$ANNOTATE/g" > $GENLOC/$FILE
# I add the contents right after the head
cat $SRCLOC/$FILE >> $GENLOC/$FILE
# I now add the foot and replace the XX- strings
cat $SRCLOC/$FOOTFILE | sed -e "s/XX-FILE/$FILE/g" -e "s/XX-DATE/$DATE/g" >> $GENLOC/$FILE
# I remind myself where the generated output is.
echo "generated in $GENLOC/"$FILE
