#!/usr/bin/perl

# Name:   webify.pl
# Author: John F. Hagan
# Date:   01/99 
#
# Purpose: to take Harry Lincoln's SOURCES SCRIPT file and separate each	
#          record into its respective RISM.  Lines are italicized properly 
#          first.
#

$input     = "/local/www/faculty/lincoln/sources.stage12";
$output    = "/local/www/faculty/lincoln/sources.html";

open(SOURCES, "$input");
open(OUTPUT,">>$output");

print OUTPUT <<TOPOFPAGE;
<html>
<head>
<title>The Latin Motet: Indexes to Printed Collections, 1500-1600</title>
</head>
<body bgcolor="#FFFFFF">
<center>
<h1>The Latin Motet: Indexes to Printed Collections, 1500-1600</h1>
<h2>Index to Sources</h2>
</center>
TOPOFPAGE

while (<SOURCES>) {
   s/^\.us on/<I>/;      #substitute <I>  for .us on 
   s/^\.us off/<\/I>/;   #substitute </I> for .us off
   s/^\.bd on/<B>/;      #substitute <B>  for .bd on
   s/^\.bd off/<\/B>/;   #substitute </B> for .bd off
   s/^\.bi on//;    #substitute </I> for .bi on
   s/^\.bi off//;     #substitute <I>  for .bi off
   s/^\.sk/<P>/;         #substitute <P>  for .sk
   s/@/&nbsp\;/g;        #substitute &nbsp; for @ globally
   
   # make table substitutions
   s/^\.fo on/<\/TABLE><P><BR>/;
   s/^\.fo off/<P><TABLE BORDER="0" WIDTH="75%">/;
   
   if (/<TD>/) {       # new table row entry
      s/^(.)/<TR>$1/;
      s/(.)$/$1<\/TR>/;
      }
   print(OUTPUT);
   }

print OUTPUT <<ENDOFPAGE;
</table>
<p>
</b>
Information compiled by 
<a href="mailto:bg0056\@bingvmb.cc.binghamton.edu">Harry B. Lincoln</a><br>
Professor Emeritus<br>
Department of Music<br>
Binghamton University<br>
</body>
</html>
ENDOFPAGE
