#!/usr/local/bin/perl
# Program to read in a text definition list
# and tunr it into an html definition list, while
# also extracting out all the fund names.
# Chris Seidel  1-31-99

$new_image = "<img src=\"http://www.primenet.com/~seidel/images/new.gif\" alt=\"new\">";

$template = "/home/pangloss/public_html/Fund/Util/template.txt";

 open(TEMPLATE, "$template")
    or die("Can't open file $template");

$startlist = 0;
$new = 0;
print "<HTML><FORM>\n";

print "<DL>\n";
 while( <TEMPLATE> ){
     chomp();
     while( substr($_,0,1) eq " " ){
         $_ = substr($_,1);
     }

     if( s/\[new\]// ){ #check for new image tag
	 $new = 1;
     }

     #find Fund symbols, and strip them from parenthesis
     if(/\(.*\)/){
         ($fund = $&) =~ s/[\(\)]//g;
         push(@funds, $fund);
	 print "    <DD><a href=\"./$fund.html\">$_</a>\n";
     }
     else{
	 if( length($_) < 2 && !$startlist){
	     $startlist = 1;
	 }
	 else{
           #must be a title
	     print "  <DT><FONT SIZE=\"+1\"><B>$_</FONT></B>\n";
	 }
     }
     if( $new ){
	 print "$new_image\n";
	 $new = 0;
     }
     if($startlist){
       print "</DL>\n<DL>\n";
       $startlist = 0;
     }

 }
print "</DL>\n";
 close(TEMPLATE);
