" ;;
esac
html "$*"
}
end_list() {
html "$_LIST_TYPE>"
# restore nested list data
if [ "$LIST_DEPTH" -gt 1 ]; then
eval "eval \"\$LIST_VARS_$LIST_DEPTH\""
fi
#LIST_DEPTH=`expr "$LIST_DEPTH" - 1`
inc -1 LIST_DEPTH
}
#----------------------------------------------------------------------------
#
# preformatted text
#
begin_pre() {
html ""
}
#
end_pre() {
html "
"
}
preformatted() {
begin_pre
html "$@"
end_pre
}
#----------------------------------------------------------------------------
#
# divisions
# usage: begin_division [-L|C|R] size text...
# -L,C,R left, center, right alignment
#
begin_division() {
_DIV_OPTS=
while [ "$#" != 0 ]; do
case "$1" in
-L)
_DIV_OPTS="$_DIV_OPTS ALIGN=LEFT" ;;
-C)
_DIV_OPTS="$_DIV_OPTS ALIGN=CENTER" ;;
-R)
_DIV_OPTS="$_DIV_OPTS ALIGN=RIGHT" ;;
*)
break
esac
shift
done
html "\
$*"
}
#
end_division() {
html "
"
}
#----------------------------------------------------------------------------
#
# center
#
begin_center() {
html ""
}
#
end_center() {
html ""
}
#
# center
# usage: center [-L|C|R] text...
# -L,C,R left, center, right alignment
#
center() {
_CENTER_OPTS=
while [ "$#" != 0 ]; do
case "$1" in
-[LRC])
_CENTER_OPTS="$_CENTER_OPTS $1" ;;
--)
shift; break ;;
*)
break
esac
shift
done
begin_center$_CENTER_OPT
html "$@"
end_center
}
#----------------------------------------------------------------------------
#
# begin blockquote
# usage: begin_blockquote
#
begin_blockquote() {
html ""
}
#
# end blockquote
# usage: end_blockquote
#
end_blockquote() {
html "
"
}
#
# blockquote
# usage: blockquote text...
#
blockquote() {
tag_data BLOCKQUOTE "$*"
}
#----------------------------------------------------------------------------
#
# need to do FORM's...
#
#----------------------------------------------------------------------------
#
# horizontal rule
# usage: do_hrule [-L|C|R] [-ns] [-s size] [-w width] [num_rules]
# -L|C|R left, center, or right alignment
# -ns no shade
# -s size
# -w width
#
do_hrule() {
_HRULE_NUMS=1
_HRULE_OPTS=
while [ "$#" != 0 ]; do
case "$1" in
-L)
_HRULE_OPTS="$_HRULE_OPTS ALIGN=LEFT" ;;
-C)
_HRULE_OPTS="$_HRULE_OPTS ALIGN=CENTER" ;;
-R)
_HRULE_OPTS="$_HRULE_OPTS ALIGN=RIGHT" ;;
-ns)
_HRULE_OPTS="$_HRULE_OPTS NOSHADE" ;;
-s)
shift; _HRULE_OPTS="$_HRULE_OPTS SIZE=$1" ;;
-w)
shift; _HRULE_OPTS="$_HRULE_OPTS WIDTH=\"$1\"" ;;
*)
break
esac
shift
done
# number of hrule's
case "$1" in
[1-9]|[1-9][0-9]|[1-9][0-9][0-9])
_HRULE_NUMS=`nawk <&- 'BEGIN {
for (I=0; I+0 < '"$1"'; ++I)
NUMS = NUMS " " I;
} END {
print NUMS;
}'`
esac
for _HRULE_NUM in $_HRULE_NUMS; do
html "
"
done
}
#----------------------------------------------------------------------------
##
## ** tables **
##
#
# usage:
# begin_table [-b num] [-cap "caption"] [-cols num] [-cp num] [-cs num] \
# [-L|C|R] [-bg color] [-hs num] [-vs num]
# table_data [-B|M|T] [-L|C|R] [-H] [-h num] [-w num] [-br] [-nowrap] \
# [-font mod] [-cspan num] [-rspan num] [-bg color] [--]
# [new_table_row]
# ...
# end_table
#
# begin_table options:
# -b num table border
# -bg color background color
# -cap "caption" caption
# -cols num number of columns
# -cp num cell padding
# -cs num cell spacing
# -L, -C, -R left, center or right horizontal alignment
# -w num table width
# -hs num pixels added to left and right of the table
# -vs num pixels added to top and bottom of the table
#
# table_data options:
# -B, -M, -T bottom, middle or top vertical alignment
# -L, -C, -R left, center or right horizontal alignment
# -H header element
# -bg color background color
# -h num cell height
# -w num cell width
# -br break automatically after each line
# -nowrap no wrapping modifier
# -font mod font size modification, eg "+2"
# -cspan num column span
# -rspan num row span
# -- no more options
#
# with the -cols option on begin_table, it is not necessary to explicitely
# specify the end or beginning each row; just use table_data repeatedly,
# and the columns are counted automatically; new_table_row can be called
# to end a short row and begin a new one;
#
# tables get a little complicated with nesting, and with COLSPAN and ROWSPAN;
# this might not all work right in all situations;
# this would be much easier if not doing automatic column counting;
#
# columns and rows:
# _TABLE_COLNUM is initialized at 0 at the beginning of each row,
# and goes from 1 thru N while data is being formatted;
# _TABLE_ROWNUM starts at 0, and is incremented as each row
# is begun;
#
_TABLE_DEPTH=0 # for nesting
#
# begin_table
# see options above
#
begin_table() {
# for nested tables, hold state
#_TABLE_DEPTH=`expr "$_TABLE_DEPTH" + 1`
inc _TABLE_DEPTH
if [ "$_TABLE_DEPTH" -gt 1 ]; then
#
# this throws a bunch of state info into a variable in the
# form of `VAR="value"'...
# this is later eval'd to restore the variables
#
eval "TABLE_VARS_$_TABLE_DEPTH=\"\
_TABLE_STAT=\\\"$_TABLE_STAT\\\"
_TABLE_COLNUM=\\\"$_TABLE_COLNUM\\\"
_TABLE_ROWNUM=\\\"$_TABLE_ROWNUM\\\"
_TABLE_COLS=\\\"$_TABLE_COLS\\\"
_TABLE_COLMAX=\\\"$_TABLE_COLMAX\\\"
_TABLE_COLNUMS=\\\"$_TABLE_COLNUMS\\\"
`for _TI in $_TABLE_COLNUMS; do
eval \"echo \\\"_TABLE_RSPAN_\$_TI=\\\\\\\"\\\$_TABLE_RSPAN_\$_TI\\\\\\\"\\\"\"
done`\""
fi
_TABLE_STAT=0 # 0: nothing printed
# 1: printed
# 2: data printed
# 3:
printed
_TABLE_COLNUM=0 # which column we're in
_TABLE_ROWNUM=0 # which row we're in
_TABLE_COLS=999 # number of columns to use
_TABLE_COLMAX=0 # the max column number used in this table
_TABLE_COLNUMS= # contains a token for each column number,
# for klutzy shell counting
_TABLE_CAPTION= # the table caption
_TABLE_OPTS= # table options
while [ "$#" != 0 ]; do
case "$1" in
-L) # left align (doesn't seem to work)
_TABLE_OPTS="$_TABLE_OPTS ALIGN=LEFT" ;;
-C) # center align table (doesn't seem to work)
_TABLE_OPTS="$_TABLE_OPTS ALIGN=CENTER" ;;
-R) # right align table (doesn't seem to work)
_TABLE_OPTS="$_TABLE_OPTS ALIGN=RIGHT" ;;
-b) # border
shift; _TABLE_OPTS="$_TABLE_OPTS BORDER=\"$1\"" ;;
-bg) # background color
shift; _TABLE_OPTS="$_TABLE_OPTS BGCOLOR=\"$1\"" ;;
-cap) # caption
shift; _TABLE_CAPTION="$1" ;;
-cols) # num columns
shift; _TABLE_COLS="$1" ;;
-cp) # cell padding
shift; _TABLE_OPTS="$_TABLE_OPTS CELLPADDING=\"$1\"" ;;
-cs) # cell spacing
shift; _TABLE_OPTS="$_TABLE_OPTS CELLSPACING=\"$1\"" ;;
-hs) # horizontal space
shift; _TABLE_OPTS="$_TABLE_OPTS HSPACE=\"$1\"" ;;
-vs) # vertical space
shift; _TABLE_OPTS="$_TABLE_OPTS VSPACE=\"$1\"" ;;
-w) # width
shift; _TABLE_OPTS="$_TABLE_OPTS WIDTH=\"$1\"" ;;
--) # width
shift; break ;;
*)
break
esac
shift
done
html ""
if [ -n "$_TABLE_CAPTION" ]; then
tag_data CAPTION "$_TABLE_CAPTION"
fi
}
end_table() {
end_table_row
html "
"
# restore nested table data
if [ "$_TABLE_DEPTH" -gt 1 ]; then
eval "eval \"\$TABLE_VARS_$_TABLE_DEPTH\""
#echo "--------------------" >&2
#eval "echo \"\$TABLE_VARS_$_TABLE_DEPTH\"" >&2
#echo "--------------------" >&2
fi
inc -1 _TABLE_DEPTH
}
#
# table rows
#
#
# this should never need to be called directly by the user;
#
begin_table_row() {
html ""
_TABLE_COLNUM=0
inc _TABLE_ROWNUM
_TABLE_STAT=1
}
#
# this should never need to be called directly by the user;
#
end_table_row() {
html "
"
_TABLE_STAT=3
# adjust the RSPAN on any remaining columns if needed
while [ "$_TABLE_COLNUM" -lt "$_TABLE_COLMAX" ]; do
inc _TABLE_COLNUM
eval "_TD_RSPAN=\"\$_TABLE_RSPAN_$_TABLE_COLNUM\""
if [ -z "$_TD_RSPAN" ]; then
_TD_RSPAN=0
eval "_TABLE_RSPAN_$_TABLE_COLNUM=0"
fi
[ "$_TD_RSPAN" -lt 1 ] && continue
inc -1 _TD_RSPAN
eval "_TABLE_RSPAN_$_TABLE_COLNUM=\"$_TD_RSPAN\""
done
}
#
# start a new row;
# this can be called by the user to end a short row;
#
new_table_row() {
[ "$_TABLE_STAT" -eq 2 ] && end_table_row
[ "$_TABLE_STAT" -eq 0 -o "$_TABLE_STAT" -eq 3 ] && begin_table_row
_TABLE_COLNUM=0
}
#
# table_data
# see above for options
#
table_data() {
_TD_BR= #
between lines
_TD_FONTMOD= # for now, this can just be the size
_TD_TYPE="TD" # data (TD) or header (TH)
_TD_CSPAN_OPT=1 # -cspan option
_TD_RSPAN_OPT=1 # -rspan option
_TD_OPTS= # options for
#echo "table_data: \"$*\"" >&2
while [ "$#" != 0 ]; do
case "$1" in
-B) # bottom vertical alignment
_TD_OPTS="$_TD_OPTS VALIGN=BOTTOM" ;;
-C) # center horizontal alignment
_TD_OPTS="$_TD_OPTS ALIGN=CENTER" ;;
-L) # left horizontal alignment
_TD_OPTS="$_TD_OPTS ALIGN=LEFT" ;;
-M) # middle vertical alignment
_TD_OPTS="$_TD_OPTS VALIGN=MIDDLE" ;;
-R) # right horizontal alignment
_TD_OPTS="$_TD_OPTS ALIGN=RIGHT" ;;
-T) # top vertical alignment
_TD_OPTS="$_TD_OPTS VALIGN=TOP" ;;
-H) # header cell
_TD_TYPE="TH" ;;
-bg) # background color
shift; _TD_OPTS="$_TD_OPTS BGCOLOR=\"$1\"" ;;
-br) # auto 's
_TD_BR=" " ;;
-nowrap) # no wrapping
_TD_OPTS="$_TD_OPTS NOWRAP" ;;
#
# probably should get rid of -font, and leave that up to a
# user-defined wrapper function;
#
-font) # font modifier
shift; _TD_FONTMOD="$1" ;;
-h) # cell height
shift; _TD_OPTS="$_TD_OPTS HEIGHT=\"$1\"" ;;
-w) # cell width
shift; _TD_OPTS="$_TD_OPTS WIDTH=\"$1\"" ;;
-cspan) # column span
shift; _TD_CSPAN_OPT="$1"
_TD_OPTS="$_TD_OPTS COLSPAN=$1" ;;
-rspan) # row span
shift; _TD_RSPAN_OPT="$1"
_TD_OPTS="$_TD_OPTS ROWSPAN=$1" ;;
*)
break
esac
shift
done
_TD_DATA="$*"
#
# column and row adjustment
#
while : ; do
#
# adjust the column;
# start a new row if necessary;
#
inc _TABLE_COLNUM
if [ "$_TABLE_STAT" -eq 0 -o "$_TABLE_COLNUM" -gt "$_TABLE_COLS" ]; then
new_table_row
_TABLE_COLNUM=1
fi
#echo "_TABLE_COLNUM=\"$_TABLE_COLNUM\" _TABLE_COLS=\"$_TABLE_COLS\"" >&2
#
# if this is the first row of a table, then go ahead and
# intialize the RSPAN for this column
#
[ "$_TABLE_ROWNUM" -eq 1 ] && eval "_TABLE_RSPAN_$_TABLE_COLNUM=0"
#
# increment COLMAX if needed
#
if [ "$_TABLE_COLMAX" -lt "$_TABLE_COLNUM" ]; then
_TABLE_COLMAX="$_TABLE_COLNUM"
_TABLE_COLNUMS="$_TABLE_COLNUMS $_TABLE_COLNUM"
fi
#
# get and maybe set the RSPAN for this column;
# if it's below threshold, break from loop;
# otherwise, skip this column;
#
eval "_TD_RSPAN=\"\$_TABLE_RSPAN_$_TABLE_COLNUM\""
#if [ -z "$_TD_RSPAN" ]; then
# _TD_RSPAN=0
# eval "_TABLE_RSPAN_$_TABLE_COLNUM=0"
# fi
#echo "_TD_RSPAN=\"$_TD_RSPAN\"" >&2
[ "$_TD_RSPAN" -lt 1 ] && break
#
# adjust the RSPAN for the column
#
inc -1 _TD_RSPAN
eval "_TABLE_RSPAN_$_TABLE_COLNUM=\"$_TD_RSPAN\""
# and try again
done
#
# beginning table data tag and options
#
html "<$_TD_TYPE$_TD_OPTS>"
[ -n "$_TD_FONTMOD" ] && begin_font -s $_TD_FONTMOD
#
# split up the arg lines into the positional parameters, and
# output the table element data, optionally adding a break
# between each line
#
set -f
_TD_IFS_HOLD="$IFS"
# next string holds a newline character
IFS='
'
set -- X $_TD_DATA
shift
IFS="$_TD_IFS_HOLD"
set +f
for _TD_ARG do
shift
if [ $# = 0 ]; then
# don't need a break after the last line
html "$_TD_ARG"
else
html "$_TD_ARG$_TD_BR"
fi
done
#echo "[$_TABLE_ROWNUM/$_TABLE_COLNUM]"
#
# finish up the table element
#
[ -n "$_TD_FONTMOD" ] && end_font
html "$_TD_TYPE>"
_TABLE_STAT=2
#
# account for -cspan and -rspan;
# since -rspan doesn't have any effect until the next row(s),
# wait until now to add that in;
# if a -cspan has also been given, then this should be done
# for that many columns;
#
_TD_RSPAN=0
if [ "$_TD_RSPAN_OPT" -gt 1 ]; then
_TD_RSPAN="$_TD_RSPAN_OPT"
inc -1 _TD_RSPAN
fi
_TD_CSPAN=0
if [ "$_TD_CSPAN_OPT" -gt 1 ]; then
_TD_CSPAN="$_TD_CSPAN_OPT"
inc -1 _TD_CSPAN
fi
# if -cspan (>1), NEWCOL will be the COLNUM of the final column
_TD_NEWCOL="$_TABLE_COLNUM"
if [ "$_TD_CSPAN" -gt 0 ]; then
inc "$_TD_CSPAN" _TD_NEWCOL
[ "$_TD_NEWCOL" -gt "$_TABLE_COLS" ] && _TD_NEWCOL="$_TABLE_COLS"
fi
while : ; do
# set the RSPAN for this column
#eval "echo \"setting _TABLE_RSPAN_$_TABLE_COLNUM=\\\"$_TD_RSPAN\\\"\"" >&2
eval "_TABLE_RSPAN_$_TABLE_COLNUM=\"$_TD_RSPAN\""
# if there was a -cspan (>1), then do more columns
[ "$_TABLE_COLNUM" -ge "$_TD_NEWCOL" ] && break
inc _TABLE_COLNUM
# increment COLMAX if needed
if [ "$_TABLE_COLMAX" -lt "$_TABLE_COLNUM" ]; then
_TABLE_COLMAX="$_TABLE_COLNUM"
_TABLE_COLNUMS="$_TABLE_COLNUMS $_TABLE_COLNUM"
fi
done
}
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
##
## TEXT LEVEL ELEMENTS
##
##
## font style elements
##
#
monospace() {
tag_data TT "$@"
}
#
teletype() {
tag_data TT "$@"
}
#
italic() {
tag_data I "$@"
}
#
bold() {
tag_data B "$@"
}
#
underline() {
tag_data U "$@"
}
#
strike_thru() {
tag_data STRIKE "$@"
}
#
big() {
tag_data BIG "$@"
}
#
small() {
tag_data SMALL "$@"
}
#
subscript() {
tag_data SUB "$@"
}
#
superscript() {
tag_data SUP "$@"
}
#----------------------------------------------------------------------------
##
## phrase style elements
##
#
emphasize() {
tag_data EM "$@"
}
#
strong() {
tag_data STRONG "$@"
}
#
definition() {
tag_data DFN "$@"
}
#
code() {
tag_data CODE "$@"
}
#
sample() {
tag_data SAMP "$@"
}
#
keyboard() {
tag_data KBD "$@"
}
#
variable() {
tag_data VAR "$@"
}
#
citation() {
tag_data CITE "$@"
}
#----------------------------------------------------------------------------
##
## anchor element
##
#
# anchor
# usage: do_anchor [-h|n] [-t "title"] target [text]
# -h HREF (default)
# -n NAME
# -t advisory title
# target destination for the HREF or NAME
# text the text that will be displayed (default is the target)
#
do_anchor() {
_ANCHOR_TYPE="HREF"
_ANCHOR_TITLE=
_ANCHOR_TARGET=
_ANCHOR_TEXT=
while [ "$#" != 0 ]; do
case "$1" in
-h)
_ANCHOR_TYPE="HREF" ;;
-n)
_ANCHOR_TYPE="NAME" ;;
-t)
shift; _ANCHOR_TITLE=" TITLE=\"$1\"" ;;
*)
break
esac
shift
done
_ANCHOR_TARGET="$1"
if [ "$#" -le 1 ]; then
_ANCHOR_TEXT="$1"
else
shift
_ANCHOR_TEXT="$*"
fi
html -n "$_ANCHOR_TEXT"
}
#----------------------------------------------------------------------------
##
## image element
##
#
# image
# usage: do_image [-B|M|T|L|R] [-b num] [-h num] [-w num] \
# [-hs num] [-vs num] [-usemap url] "src" ["alt"]
# -B,M,T,L,R bottom, middle, top, left, right alignment
# -b border
# -h height
# -w width
# -hs horizontal gutter
# -vs vertical gutter
# -usemap use client-side image map
# src the image source
# alt alternative text
#
do_image() {
_IMAGE_SRC=
_IMAGE_ALT=
_IMAGE_OPTS=
while [ "$#" != 0 ]; do
case "$1" in
-B)
_IMAGE_OPTS="$_IMAGE_OPTS ALIGN=BOTTOM" ;;
-M)
_IMAGE_OPTS="$_IMAGE_OPTS ALIGN=MIDDLE" ;;
-T)
_IMAGE_OPTS="$_IMAGE_OPTS ALIGN=TOP" ;;
-L)
_IMAGE_OPTS="$_IMAGE_OPTS ALIGN=LEFT" ;;
-R)
_IMAGE_OPTS="$_IMAGE_OPTS ALIGN=RIGHT" ;;
-b)
shift; _IMAGE_OPTS="$_IMAGE_OPTS BORDER=$1" ;;
-h)
shift; _IMAGE_OPTS="$_IMAGE_OPTS HEIGHT=$1" ;;
-w)
shift; _IMAGE_OPTS="$_IMAGE_OPTS WIDTH=$1" ;;
-hs)
shift; _IMAGE_OPTS="$_IMAGE_OPTS HSPACE=$1" ;;
-vs)
shift; _IMAGE_OPTS="$_IMAGE_OPTS VSPACE=$1" ;;
-usemap)
shift; _IMAGE_OPTS="$_IMAGE_OPTS USEMAP=\"$1\"" ;;
*)
break
esac
shift
done
_IMAGE_SRC="$1"
if [ "$#" -gt 1 ]; then
shift
_IMAGE_ALT=" ALT=\"$*\""
fi
html -n ""
}
#----------------------------------------------------------------------------
##
## font element
##
#
# change font
# usage: begin_font [-c color] [-f face] [-s size]
#
begin_font() {
_FONT_OPTS=
while [ "$#" != 0 ]; do
case "$1" in
-c)
shift; _FONT_OPTS="$_FONT_OPTS COLOR=$1" ;;
-f)
shift; _FONT_OPTS="$_FONT_OPTS FACE=$1" ;;
-s)
shift; _FONT_OPTS="$_FONT_OPTS SIZE=$1" ;;
*)
break
esac
shift
done
html ""
}
#
end_font() {
html ""
}
#----------------------------------------------------------------------------
##
## basefont element
##
#
# basefont
# usage: basefont size
#
basefont() {
html ""
}
#----------------------------------------------------------------------------
##
## break element
##
#
# add text breaks
# usage: do_break [-c[L|R]] [num]
#
do_break() {
_BREAK_NUMS=1
_BREAK_CLEAR=
while [ $# != 0 ]; do
case "$1" in
-c) _BREAK_CLEAR=" CLEAR=ALL" ;;
-cL) _BREAK_CLEAR=" CLEAR=LEFT" ;;
-cR) _BREAK_CLEAR=" CLEAR=RIGHT" ;;
*) break
esac
shift
done
case "$1" in
[1-9]|[1-9][0-9]|[1-9][0-9][0-9])
_BREAK_NUMS=`nawk <&- 'BEGIN {
for (I=0; I+0 < '"$1"'; ++I)
NUMS = NUMS " " I;
} END {
print NUMS;
}'`
esac
for _BREAK_NUM in $_BREAK_NUMS; do
html " "
done
}
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
#
# some misc. routines
#
#
# do some simple math; default is increment
# usage: inc {[num] varname...}...
#
inc() {
_INC_NUM=1
while [ $# != 0 ]; do
case "$1" in
[0-9-]*)
_INC_NUM="$1"
shift
esac
eval "$1=\`expr \"\$$1\" + \"$_INC_NUM\"\`"
shift
done
}
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
#
# need all this stuff for the "last update" calculation below, blech!
#
CURR_DAY=`date '+%e'`
CURR_MONTH=`date '+%b'`
CURR_MONTH_NUM=`date '+%m' | sed 's/^0//'`
CURR_YEAR=`date '+%Y'`
M_Jan="January" N_Jan="1"
M_Feb="February" N_Feb="2"
M_Mar="March" N_Mar="3"
M_Apr="April" N_Apr="4"
M_May="May" N_May="5"
M_Jun="June" N_Jun="6"
M_Jul="July" N_Jul="7"
M_Aug="August" N_Aug="8"
M_Sep="September" N_Sep="9"
M_Oct="October" N_Oct="10"
M_Nov="November" N_Nov="11"
M_Dec="December" N_Dec="12"
# get the mod. date of the file, convert it to "dd Month yyyy"
get_update_date() {
GUD_FILE="$1"
GUD_LS=`ls -l "$GUD_FILE"`
set -- $GUD_LS
for GUD_OPT do
case "$GUD_OPT" in
Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
break
;;
*)
shift
esac
done
GUD_YEAR="$3"
eval "GUD_MONTH_NUM=\"\$N_$1\""
case "$3" in
*:*)
if [ "$CURR_MONTH_NUM" -ge "$GUD_MONTH_NUM" ]; then
GUD_YEAR="$CURR_YEAR"
else
GUD_YEAR=`expr "$CURR_YEAR" - 1`
fi
esac
eval "GUD_MONTH=\"\$M_$1\""
echo "$2 $GUD_MONTH $GUD_YEAR"
}
do_last_update() {
html "\
Page last updated: $UPDATE_DATE
"
}
#----------------------------------------------------------------
#----------------------------------------------------------------
#
# might be some other stuff to source,
# this would be from the -s option;
#
for SOURCE_FILE in $SOURCE_FILES; do
case "$SOURCE_FILE" in
?*)
. "$SOURCE_FILE"
esac
done
##
## process (source) each input file
##
for FILE do
case "$FILE" in
# for stdin, make a tmp file and just process to stdout
-)
: ${UPDATE_DATE=`date '+%e %B %Y'`}
HTML_FILE="???.$OUT_SUFFIX"
[ "$QUIET" = 0 ] && echo "$PROG: processing stdin..." >&2
cat > "$TMP_FILE"
. "$TMP_FILE"
rm -f "$TMP_FILE"
;;
# otherwise, process and output to filename.html
*)
case "$FILE" in
*."$IN_SUFFIX")
OUT_FILE=`echo "$FILE" | sed 's/.'"$IN_SUFFIX"'$/.'"$OUT_SUFFIX"'/'`
;;
*)
OUT_FILE="$FILE.$OUT_SUFFIX"
if [ ! -f "$FILE" -a -f "$FILE.$IN_SUFFIX" ]; then
FILE="$FILE.$IN_SUFFIX"
fi
esac
HTML_FILE="$OUT_FILE"
[ "$QUIET" = 0 ] && echo "$PROG: processing $FILE" >&2
{
UPDATE_DATE=`get_update_date "$FILE"`
case "$FILE" in
*/*)
. "$FILE" # source it
;;
*)
. "./$FILE" # source it
esac
} > "$OUT_FILE"
esac
done
exit 0
|