head     1.1;
branch   ;
access   ;
symbols  ;
locks    perlman:1.1; strict;
comment  @# @;


1.1
date     96.06.20.15.02.24;  author perlman;  state Exp;
branches ;
next     ;


desc
@@



1.1
log
@Initial revision
@
text
@function genname # format a person's name in bold
	{
	sed -e 's/\([^,]*\)/<b>\1<\/b>/' -e 's/$/<br>/'
	}

function genliststart
	{
	echo "<dl>"
	}

function genlistend
	{
	echo "</dl>"
	}

function genlistitem
	{
	echo "<dt>$1<dd>$2"
	}

function gentablestart
	{
	echo "<table border=2>"
	}

function gentableend
	{
	echo "</table>"
	}

function genpubtab # category [codename] # generate pub list
	{
	category=$1
	codename=$2
	catrec=`sssearch "category=$category" pubs.db`
	sortkeys=`echo "$catrec" | ssformat -t %sortkeys`
	tabent=`echo "$catrec" | ssformat -t %tabent`
	gentablestart
	if test "$codename"
	then
		sssearch codename=$codename $category.db
	else
		cat $category.db
	fi | sssort -f "$sortkeys" |
		genrecord |
			ssformat -t "$tabent"
	gentableend
	}

function genheader # title [url] [category] # generate the header of a page
	{
	title="$1"
	echo "<html><head><title>$title</title></head>"
	echo "<body bgcolor=ffffff>"

	echo "<h2>"
	echo "<a href=http://www.acm.org/>ACM</a>"
	echo "<a href=http://www.acm.org/sigchi/>SIGCHI</a>"
	if test "$3"
	then
		echo "$3<br>"
	fi
	if test "$2"
	then
		echo "<a href=$url>"
	fi
	echo "$title"
	if test "$2"
	then
		echo "</a>"
	fi
	echo "</h2>"
	}

function genfooter # generate the footer of a page
	{
	echo "<hr>"
	echo "<a href=http://www.acm.org/catalog>[ACM catalog]</a>"
	echo "<a href=http://www.acm.org/sigchi>[SIGCHI]</a>"
	echo "<a href=http://www.acm.org/sigchi/publications>[SIGCHI Pubs]</a>"
	echo "</body></html>"
	}

function gentabent # generate a paired value table
	{
	eval `echo value='$'$1` # turn $1 into a variable and interpolate
	if test "$value"
	then
		shift
		echo "<tr><td align=right> $*: <td align=left> $value <br>"
	fi
	}

function genfields # generate assignments of db fields to shell variables
	{
	DB=$1
	tmp=/tmp/pub$$
	fields=`grep "^%" < $DB |
		sed -e 's/[ 	].*$//' -e 's/^%//' |
			sort -u`
	for field in $fields
	do
		echo "$field"'=`echo "$record" | ssformat -t %'"$field"'`'
	done > $tmp
	echo $tmp
	}

function genrecord #prepend a documenting record to the standard input
	{
	echo "
%type TYPE
%title TITLE
%editor EDITOR
%freq FREQ
%author AUTHOR
%desc DESC
%year YEAR
%pages PAGES
%format FORMAT
%ISBN ISBN
%pricemember MEMBER
%pricenonmember NONMEMBER
%avail AVAIL
%pricestudent STUDENT
%acmordernumber ACM#
%imagesmall THUMBNAIL
%imagelarge IMAGE
%issue ISSUE
%contents CONTENTS

"

cat
}

function gencontact # print contact information
{
echo "<hr>
<address>
<h3>Contact Information</h3>
<dl>
	<dt>Mailing Address:<dd>
		ACM<br>
		PO Box 12105<br>
		Church St. Station<br>
		New York, NY 10257 USA
	<dt>Email:<dd>
		<a href=mailto:acmhelp@@acm.org
			>acmhelp@@acm.org</a>
	<dt>Fax:<dd>
		+1-212-944-1318
	<dt>Phone Orders:<dd>
		1-800-342-6626 (USA and Canada)<br>
		+1-212-626-0500 (metro NY and outside USA)
</dl>
In Europe:
<dl>
	<dt>Mailing Adress:<dd>
		ACM European Serice Centre<br>
		108 Cowley Road<br>
		Oxford, OX4 1JF, UK
	<dt>Email:<dd>
		<a href=mailto:acm_europe@@acm.org
			>acmhelp@@acm.org</a>
	<dt>Fax:<dd>
		+44-1865-381338
	<dt>Phone Orders:<dd>
		+44-1865-382338
</dl>
</address>
"
}

function debug # echo parameters to the screen
	{
	echo "$*" > /dev/tty
	}
@
