#!/bin/bash
#
# Give it a html body without any <body> or </html> or <title> or whatever.
# Don't use a <h1>title</h1> either, if will be supplied.
# Write the documents title in the first line.
# Then this script generates you a complete web-page in YaST2-style.
#

if [ "$1" ] ; then
    exec < $1
fi

read title
if [ "$title" == "Index" ] ; then
    footer_1='<TABLE WIDTH="100%"><TR><TD ALIGN="left" VALIGN="top"><i>YaST2 Developers Documentation: </i><b>'
    footer_2='</b></TD><TD ALIGN="RIGHT" VALIGN="TOP"><img src="/usr/share/doc/packages/ydoc/images/yast2-mini.png"></TD></TR></TABLE>'
else
    footer_1='<TABLE WIDTH="100%"><TR><TD ALIGN="left" VALIGN="top"><i>YaST2 Developers Documentation: </i><b>'
    footer_2='</b></TD><TD ALIGN="RIGHT" VALIGN="TOP"><a href="/usr/share/doc/packages/yast2-doc/index.html"><img src="/usr/share/doc/packages/ydoc/images/yast2-mini.png" border=0></a></TD></TR></TABLE>'
fi

cat <<EOF
<HTML><HEAD><TITLE>$title</TITLE></HEAD><BODY bgcolor="#c8c8c8">
$footer_1 $title $footer_2<hr>
<TABLE><TR>
<td valign=top align=center><img src="/usr/share/doc/packages/ydoc/images/yast2-half.png"><br><br></td>
<TD VALIGN=TOP><TD VALIGN=TOP>
<h1>$title</h1>
EOF

cat

cat <<EOF
</TABLE>
</td></tr></table>
<HR>
$footer_1 $title $footer_2
</BODY></HTML>
EOF
