#!/usr/local/bin/jperl
# 
# ref2html: Converter from references list (CSV) to html.
# 
#     Apr.26,'96. OSHIRO Naoki.
#     [1997/05/14] OSHIRO Naoki. Modified for Perl5
# 
#     $Log: ref2html.pl,v $
#     Revision 1.2  1996/05/28 19:29:56+09  oshiro
#     Divide forhtml function (forhtml.pl).
#
#     Revision 1.1  1996/05/28 19:15:40+09  oshiro
#     Initial revision
#
#

require "/home/grp1/oshiro/bin/forhtml.pl";

$_=<>;
&forhtml($_);

&print_header;
print "<OL>\n";
while (<>) {
    next if /^\s*$/;
    next if /^\s+/; # メモコメントはとりあえず無視 [1996/11/21]
    if (/^###\s*(.*)/) {
	print "</OL>\n<HR>\n\n";
	print "<H2>$1</H2>\n";
	print "<OL>\n";
	next;
    }
    if (/^[-#\[]/) {
	   print "<HR>\n" if ($hr==0);
	   $hr=1;
	   next;
    }
    $hr=0;
    s/^/<LI>/;
    s/[,，]\s*{(.*)$/\n<UL>\n<LI>\1/;
    s/}\s*[,，]/\n<LI>/;
#    s/(\]?)([.．,，]?)\s*@{([^}]+)}\s*([.，])?/$1$2/; $keyword=$3; # Get keyword
    s/(\]?)([.．,，]?)\s*@\{([^}]+)}\s*([.，])?/$1$2/; $keyword=$3; # Get keyword
    $gdate="";
    $gdate=$3 if (s/([.．]?)([,，]?)\s*\[G\[(.+)\]\]\s*/$1/);
    $gdate=$3 if (s/([.．]?)([,，]?)\s*(\[G\])\s*/$1/);
    s/[,，]\s*[.．]\s*//g;
    s/\n\s*\n//g;
 
    print "$_";
    print "<LI><FONT COLOR=\"#d2691e\">$keyword<\/FONT>\n" if ($keyword ne "");
    print "\n<LI><FONT COLOR=\"#4682b4\">$gdate<\/FONT>\n" if ($gdate ne "");
    print "<\/UL>\n";
}
print "</OL>\n";
&print_footer;

# major-mode: perl
