#!/usr/bin/perl

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

$input     = "/local/www/faculty/lincoln/titles.script";
$outputdir = "/local/www/faculty/lincoln/titles";

open(TITLES, $input);
while (<TITLES>) {
   s/\(\+/<\/I>\(/;  #substitute 1st occurrence of + to </I>
   s/\+/<I>/;    #substitute 2nd occurrence of + to <I>
   s/\)\(\+/<\/I>\)\(/;  #substitute 3rd occurrence of + to </I>
   
   if (/\((\w+)\/(\w+)\)$/) {
      $filename = join('_', $1,$2);
      open(OUTPUT,">>$outputdir/$filename.html");
      print(OUTPUT "<I>");  #we need to start each record in italics mode
      print(OUTPUT);
      print(OUTPUT "<BR>"); #end each record with a break
      }
   }
