#!/bin/sh
####
# NAME
#	plain-to-html
# VERSION
#	$Id$
# CHANGELOG
#	$Log$
# USAGE
#	plain-to-html title
# DESCRIPTION
#  The plain-to-html scripts read from plain text and write plain html.
# COPYRIGHT
#  Copyright (C) 2000,2001 Steel Wheels Project.
#  This file is a apart of the papaya utilities. 
#  If you need the information of copyright of this file, see COPYING
#  file distributed with file or see http://www.asahi-net.or.jp/~em7t-hmd
#  web page.

THIS="plain-to-html"

error(){
	echo "$THIS [ERROR] $1" ;
	exit 1 ;
}

TITLE=$1
if test "X" = "X${TITLE}" ; then
	error "title string is not given" ;
fi

echo "<html>"
echo "<head>"
echo "  <title>$TITLE</title>"
echo "</head>"
echo "<body><pre>"
if sed -e 's/&/\&amp;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g' -e 's/"/\&quot;/g'
then
	echo "</pre></body>" ;
	echo "</html>" ;
else
	error "can not read stdin" ;
fi

exit 0 ;

