Perl script to assemble Indian Ocean Catalogue pages from troff input


#script to assemble IOC html pages
#catlook.pl
$date = `date`;
($dow, $month, $dom, $time, $tz, $year) = split(/\s+/,$date);
$date = "$month $dom, $year";
&loadcode(65);

$getent = '/cgi-bin/getent';
$exg = '/cgi-bin/exg';

#load troff to html accent translator
while(<DATA>){
	($key,$accent) = m/(.*)\t(.*)$/;
	$htmlacc{$key} = $accent;
}

dbmopen(%csname,"csname",0666) || die "couldnt open dbf\n";

$bibpath = "/users/rlmoe/ioc/"; #path to bibliography
$nnpath = "/users/rlmoe/ioc/nn/"; #path to nom. notes
$frontpath = "/users/rlmoe/ioc/front/"; #path to front matter
@frontfiles = (
"scope",
"gfp2.unx",
"abstract.out");
#path referred to in documents
$htmlpath = "";
#path to deposit html files
$htmloutpath = "/users/rlmoe/ioc/html/";
#$htmloutpath = "/data/";

$warning = "${htmlpath}comb_warning.html";
$warning_mess = "<code>WARNING! see information about new combinations.</code>";

#get the order the species files should be in
open(ORDER,"/users/rlmoe/ioc/front/phyllord.ioc") || die "couldn't open order file\n";
while(<ORDER>){
	chop;
	s#.*/##; #truncate to file name
	push(@catfiles,$_) ;
	}
close(ORDER);
# get bibliography files
opendir(IOCDIR,"$bibpath") || die "could not open $bibpath\n";
(@bibfiles) = sort(grep(/iocit\.\d+/, readdir(IOCDIR))); #biblio files -> array
closedir(IOCDIR);

#get the nomenclatural notes files
opendir(IOCDIR,"$nnpath") || die "could not open $nnpath\n";
(@nnfiles) = sort(grep(s/.*\.nn/$&/, readdir(IOCDIR))); #nn files -> array
@nnfiles = grep(!/header.nn/,@nnfiles);
closedir(IOCDIR);

	push(@catfiles,"iocexclu.out") ;
#@catfiles = ("ioc46.c");
foreach $file(@catfiles){
die "couldn't find $file\n" unless -f $file;
$infile = "perl /users/rlmoe/ioc/ucpress/index3.pl $file |";
open(IOCFILE,$infile) || die "couldn't open ${file}\n";

#for abstract
#(($class) = $file =~ m/.*(\.[rgcb])/);
undef($/);
while(<IOCFILE>){
	s/\.ds .*\n//g;
	s/\.K[SE]\n//g;
	s/\.ex\n[^\000]+/\n/ if $file =~ /ioc14.g/;

@entries = split(/\.Cs/,$_);
for $entry (reverse ($[ .. $#entries)){
substr($entries[$entry],0,0) = ".Cs";
if($entries[$entry] =~ s/(\.[DG][Sln][^\000]+)//){
substr($entries[$entry+1],0,0) = $1;
}
#else {
#substr($entries[$entry],0,0) = ".Cs";
#}
}
if($entries[$[] !~ /\.Pe/){
shift(@entries);
}
			for $i (0 .. $#entries){
				++$counter;
$counter = sprintf("%04d", $counter);
				#unless($entries[$i] =~ /^\./){
					#$entries[$i] = ".Cs" . $entries[$i];
				#}

#assemble index words
if(@indexed = $entries[$i] =~ m/(\.[CN]X.*)\n/g){
	$entries[$i] =~ s/\.[CN]X.*\n//g;
	undef(%dup_ndx); @indexed = grep(!$dup_ndx{$_}++,@indexed);
	foreach $index_ent (@indexed){
		if($index_ent =~ m/^\.([NC])X "(([A-Z][^ ]+ )([a-z][^ ]+).*)"/){
			$accepted = $1; $name = $2; $genus = $3; $epithet = $4;
$name =~ s/\\\|\?//;
			if($epithet =~ /^[a-z]/){
				$accepted = ( $accepted eq "C" ? "*"  : "");
				unless(length($sp_index{$epithet})){ $sp_index{$epithet} = "";}
				$sp_index{$epithet} .= qq
<a href = "$getent?$counter">$accepted$name</a>:
;
				}
			}
		}
}

#assemble locations
unless($file =~ /iocexclu/){
(($idlocs) = $entries[$i] =~ m/\.Id\n([^\000]+\n)/);
$idlocs =~ s/\n\.[^\000]*/\n/;
@idlocs = split(/[\\,.?\|]*\n/,$idlocs);
foreach(@idlocs){
s/ \(.*//;
s/\\\*'//;
if ($loc{$_}){
				unless(length($loclist{$_})){ $loclist{$_} = "";}
$loclist{$_} .= "$counter\t" ;
}
#grep(s/ \(.*//,@idlocs);
#grep($loclist{$_} .= "$counter\t", @idlocs);
}
}

# remember higher taxa
if($entries[$i] =~ m/[A-Z]+(ALES|ACEAE|PHYCEAE|PHYCIDAE| SEDIS)/){
while($entries[$i] =~ m/[A-Z]+( SEDIS|PHYCIDAE|PHYCEAE|ALES|ACEAE)/g){
	push(@gentag,"$&\t$counter");
}
	}

while($entries[$i] =~ s#\.Gn ([^ ]+) "(.*)"#<p>\n<STRONG>$1 $2</STRONG>#){
	push(@gentag,"$1\t$counter");
	$last_gen_ref = substr($1,0,8);
	$last_gen_ref = "bangioph" if $last_gen_ref eq "Stylonem";
	$last_gen_ref = "bangioph" if $last_gen_ref eq "Porphyro";
	$last_gen_ref = substr($&,0,8) if $entries[$i] =~ m/.*PHYCEAE/;
	$last_gen_ref = "gracilar" if $entries[$i] =~ m/GRACILARIALES/;
	}
if($entries[$i] =~ m/\.Cs "\*/){
$ITL = "* ";
}
else{
$ITL = "";
}
$entries[$i] =~ s/(\.[CSV]s.*) \(?\?\)?/$1/;
$entries[$i] =~ s/(\.[CSV]s.*)\\\|\?/$1/;

if($entries[$i] =~ s#\.Cs ["* ]*([^" ]+)"? ([^ ]+) "(.*)"\n\.Vs (.*)\n\.Ss ([^ ]+) ([^ ]+) "(.*)?"#<p>\n<STRONG>$ITL$1 $2 $3 $4 $5 $6 $7</STRONG>#){
$csname{$counter} ="$1 $2 $5 $6";
}
elsif($entries[$i] =~ s#\.Cs ["* ]*([^ "]+)"? ([^ ]+) "(.*)"\n\.Ss ([^ ]+) ([^\n ]+)( "(.*)")?#<p>\n<STRONG>$ITL$1 $2 $3 $4 $5 $7</STRONG>#){
$csname{$counter} ="$1 $2 $4 $5";
}
elsif($entries[$i] =~ s#\.Cs ["* ]*([^ "]+)"? ([^ ]+) "(.*)"#<p>\n<STRONG>$ITL$1 $2 $3</STRONG>#){
$csname{$counter} ="$1 $2";
}
else {
($name) = $entries[$i] =~ m/^(.*)/;
$entries[$i] =~ s/\n/ /g;
die "NO MATCH: $counter: $entries[$i]\n";
}
$csname{$counter} =~ s/\\+\*.//g;

$csname = $csname{$counter};

$entries[$i] = &htmltrans($entries[$i]);
				$entries[$i] =~ s/\n/ /g;
				$entries[$i] =~ s/<P>  <p>//g;

#make a cross reference if you see a ref. to notes
$entries[$i] =~ s#Taxonomic and Nomenclatural Notes#<A href="${htmlpath}\L$last_gen_ref.nn.html\E">$&</A>#;

#cross reference to Drouet class.
if($file =~ /ioc4[678].c/){
$entries[$i] =~ s/Reconciliation/<A href = "${htmlpath}reconcil.html#$csname">$&<\/A>/;
$reconcil{$csname} = "href = \"$getent?$counter\"";
}

if($entries[$i] =~ m/(comb\.|nom\.) nov.*<\/STRONG>/){
substr($entries[$i],0,0) = qq
<a href = "$warning">$warning_mess</a><br>
;
				$cnov{$csname} = "<a href = \"$getent?$counter\">";
}
if($file =~ /exclu/){
				$exclu{$csname} = "<a href = \"$getent?$counter\">";
substr($entries[$i],0,0) = qq
<STRONG>EXCLUDED RECORD</STRONG><p>
;
}
$entries[$i] =~ s/(\.[CG][ns])+$//g;
$entries[$i] =~ s/ \[page 000\]//;
die "MAC/BACK: $entries[$i]\n" if $entries[$i] =~ /\\|\.[A-Z][a-z] /;
		printf "<!--%04d-->\t%s\n", $counter, $entries[$i];
				}
			}
		}

# biblio files
@ARGV = @bibfiles;
#warn "trying to process @ARGV\n";
foreach(0 .. $#ARGV){
push(@SR,$ARGV[$_], $ARGV[$_]);
}
#tail points to next head
push(@SR, shift(@SR));
%next = @SR;
%prev = reverse(@SR);
$/ = ".Au\n";
foreach $file (@ARGV){
$infile = $bibpath . $file;
$outfile = $htmloutpath . $file . ".html";
#print "infile is $infile outfile is $outfile\n";
open(IOCFILE,$infile) || die "couldnt open $infile for input\n";
open(HTMLFILE,">$outfile") || die "couldn't open $outfile for output\n";
$prevref = qq@<a href="$htmlpath$prev{$file}.html#BOTTOM"><code>previous file&lt;--</code></A><br>\n@;
$nextref = qq@<a href="$htmlpath$next{$file}.html#TOP"><code>next file</code></A><br>\n@;
while(<IOCFILE>){
	if($. == 1){
	&printtitle("Indian Ocean Catalogue Bibliography File ${file}.html");
	s/\.Au//;
	unless($file =~ /iocit.1/){
		print HTMLFILE "<br><A name=\"TOP\"></A>\n";
		print HTMLFILE $prevref;
		}
next;
	}
	$_ = &htmltrans($_);
#special cases
#remember each first author the first time
	if(m/^Kuwait/){ $author = $&;}
	elsif (m/^Anonymous/){ $author = $&;}
	elsif (m/^Padma Sridhar/){ $author = $&;}
	elsif (m/^(Pham)-H/){ $author = $1;}
	elsif (m/^([^,]+),/){ $author = $1;}
else {$author = "";}
$prevauthor = "flabba" unless $prevauthor;
	if($author eq $prevauthor){
		s#^(.)#<p>\n$1#;
		}
	else {
		s#^.*#<p>\n<a name="$author">$&</a>#;
		$prevauthor = $author;
		push(@auttag,"<A href = \"${htmlpath}$file.html#$author\">$author</A>");
		}

	s/\.Be\n//;
	s/\.Te\n//;
	s/\.Dt "(.*)"/<blockquote>$1/;
	s/\.Dt (.*)/<blockquote>$1/;
	s/.Au\n//;
unless (m/\[see /){
	print HTMLFILE $_,"</blockquote>"
}
	else {
print HTMLFILE $_,"</P>";
}
	if(eof){
	unless($file =~ /iocit.91/){
	print HTMLFILE "<br><A name=\"BOTTOM\">--&gt;</A>\n";
	print HTMLFILE $nextref;
		print HTMLFILE &hclose, "\n";
	}
else {
		print HTMLFILE &hclose, "\n";
}
}
}
}
$/ = "\n";

#make abstract

system('perl /users/rlmoe/ioc/ucpress/ioabstra.pl');
#front files
@ARGV = @frontfiles;
#warn "trying to process @ARGV\n";
foreach $file (@ARGV){
$infile = $frontpath . $file;
$outfile = $htmloutpath . $file . ".html";

open(IOCFILE,$infile) || die "couldn't open $file for input\n";

open(HTMLFILE,">$outfile") || die "couldn't open $outfile for output\n";
while(<IOCFILE>){
	if($. == 1){
		&printtitle("Indian Ocean Catalogue Front File ${file}.html");
		print HTMLFILE "<H1>\n";
		while(<IOCFILE>){
			last if s/^\.DE\n//;
s/^\..*$//;
s/\\s[+-]\d//g;
			$_ = &htmltrans($_);
			print HTMLFILE $_;
			}
		print HTMLFILE "</H1>\n";
		}
	$_ = &htmltrans($_);
#footnote processing
if(m/\.FS/){
$footnote++;
print HTMLFILE "<a href = \"#FOOTNOTE $footnote\">[see footnote $footnote]</a>\n";
push(@footnotes,"<p>");
push(@footnotes,"<a name = \"FOOTNOTE $footnote\">$footnote </a>");
}
if(m/^\.FS/ .. /^\.FE/){
s/\.F[SE]\n//;
push(@footnotes,$_);
s/.*\n//;
}
	print HTMLFILE $_;
	if(eof){
		print HTMLFILE join("",@footnotes) if $file =~ /gfp/;
		print HTMLFILE &hclose, "\n";
		}
}
}
@ARGV = @nnfiles;
#warn "trying to process @ARGV\n";
foreach $file (@ARGV){
$infile = $nnpath . $file;
$outfile = $htmloutpath . $file . ".html";

#uniformize file names
$outfile =~ s/cerambys/ceramium/;
open(IOCFILE,$infile) || die "couldn't open $file for input\n";

open(HTMLFILE,">$outfile") || die "couldn't open $outfile\n";
while(<IOCFILE>){
	if($. == 1){
		&printtitle("Indian Ocean Catalogue Nomenclature File ${file}.html");
		if( s/\.DS.*/<H1>/){
				print HTMLFILE $_;
				while(<IOCFILE>){
						last if s/\.DE/<\/H1>/;
						$_ = &htmltrans($_);
						s/\\s[+-].//g;
						print HTMLFILE "\U$_";
						}
				}
		}

if($infile =~ /rhodophy/){
s/Bangiophycidae/<A href = ${htmlpath}"bangioph.nn.html">$&<\/A>/;
}
	$_ = &htmltrans($_);
	if(m#<STRONG>([^<]*)</STRONG>(.*<EM>comb. nov.</EM>)#){
	$nc = $1;
	unless($cnov{$nc}){
	++$counter;
print HTMLFILE qq
<a name = "ENTRY $counter" href = "$warning">$warning_mess</a><br>\n
;
	$cnov{$nc} = "<a href = \"${htmlpath}$file.html#ENTRY $counter\">";
	}
	}
	print HTMLFILE $_;
	if(eof){
		print HTMLFILE &hclose, "\n";
		}
}
}
#make opening page, index pages, etc.

#make species index
#make list of letters linked to index files
#to be printed out on TOC page

$species_nx = "<LI>Index to species\n";
$nxsuffix = "_spec.html";
foreach ("a" .. "y"){
	$species_nx .= qq
<a href = "${htmlpath}$_$nxsuffix">$_;</a>\n
;
}
$species_nx .= qq
<a href = "${htmlpath}z$nxsuffix">z</a>\n
;
#make a separate index file for each letter of alphabet
#store species in appropriate file

$outfile = "anyt.out";
open(OUTFILE,">>$outfile") || die "couldnt open $outfile\n";
foreach $species (sort (keys (%sp_index))){
	$initial = substr($species,0,1);
	if($outfile !~ /${initial}_spec/){
		print OUTFILE "</DL>\n", &hclose;
		close(OUTFILE);
		$outfile = "${htmloutpath}${initial}_spec.html";
		open(OUTFILE,">$outfile") || die "couldnt open $outfile\n";
		print OUTFILE <<EOHEAD;
<HTML>
<HEAD>
<TITLE>Index to IOC species $initial (accepted names are starred)</TITLE>
</HEAD>
<BODY>
<H1>SPECIES _${initial}_</H1>
<br>
<DL compact>
EOHEAD
		}
	print OUTFILE "\n<DT>\n$species\n";
	@refs = split(/:/, $sp_index{$species});
	#eliminate duplicates in reference string
	foreach (@refs){
		($unique{$_}) = m/>\*?(.*)</;
		}
	@sortedrefs = sort { $unique{$a} cmp $unique{$b} }(keys ( %unique));

foreach (@sortedrefs){
	if(m/\*/){
		($bareref = $_) =~ s/\*//;
		foreach (@sortedrefs){
			if($_ eq $bareref){
				$_ = "";
				}
			}
		}
	}

	#print OUTFILE "<DD>\n", join(";\n", @sortedrefs);
	print OUTFILE "<DD>\n";
foreach $i (0 .. $#sortedrefs){
	if($sortedrefs[$i] ne ""){
		if($i == $#sortedrefs){
			print OUTFILE "$sortedrefs[$i]\n";
			}
		else { print OUTFILE "$sortedrefs[$i];\n"; }
		}
	}
	undef(%unique);
}
print OUTFILE "\n</DL>\n";
		print OUTFILE &hclose, "\n";
close(OUTFILE);

open(HOME,">${htmloutpath}ioccat.html");
print HOME <<EOH;
<html>
<head>
<title> Genera of Indian Ocean Benthic Algae</title>
</head>
<body>
<H1>INDEX TO GENERA (alphabetical order)</H1>
<UL>
EOH
foreach $genus (sort (@gentag)){
if($genus =~ m/(.*)\t(.*)/){
$gname = $1; $gno = $2;
print HOME "<LI><a href = \"$getent?$gno\">$gname</a>\n" unless $gname =~ /[A-Z][A-Z]/;
}
}
print HOME "</UL>\n";
print HOME &hclose, "\n";
close(HOME);
open(HOME,">${htmloutpath}iocphyl.html");
print HOME <<EOH;
<html>
<head>
<title> Genera of Indian Ocean Benthic Algae (in Catalogue order)</title>
</head>
<body>
<H1>INDEX TO GENERA (Catalogue order)</H1>
<H2>Click on + to generate species list.</H2>
<UL>
EOH
foreach $genus (@gentag){
if($genus =~ m/(.*)\t(.*)/){
$gname = $1; $gno = $2;
unless ($gname =~ m/[A-Z][A-Z]/){
print HOME <<EOPH;
<LI><a href = "$getent?$gno">$gname</a><a href = "$exg?$gname"> +</a>
EOPH
}
else{
print HOME "<LI><a href = \"$getent?$gno\">$gname</a>\n" ;
}
}
else{
print HOME "<LI><strong>$genus</strong>\n";
}
}
print HOME "</UL>\n";
print HOME "</body>\n</html>\n";
close(HOME);

#nom notes
open(HOME,">${htmloutpath}iocnn.html") || die "couldnt open ${htmlpath}iocnn.html\n";
print HOME <<EOP;
<html>
<head>
<title> Taxonomic and Nomenclatural Notes</title>
</head>
<body>
<H1>INDEX TO TAXONOMIC AND NOMENCLATURAL NOTES</H1>
<UL>
<LI><A href = "${htmlpath}agardhie.nn.html">Agardhiella</A>
<LI><A href = "${htmlpath}bangioph.nn.html">Bangiophycidae</A>
<LI><A href = "${htmlpath}carrador.nn.html">Carradoriella</A>
<LI><A href = "${htmlpath}ceramium.nn.html">Ceramium byssoides</A>
<LI><A href = "${htmlpath}cyanophy.nn.html">Cyanophyceae</A>
<LI><A href = "${htmlpath}dictyopt.nn.html">Dictyopteris</A>
<LI><A href = "${htmlpath}ectocarp.nn.html">Ectocarpus</A>
<LI><A href = "${htmlpath}gracilar.nn.html">Gracilaria</A>
<LI><A href = "${htmlpath}lophosip.nn.html">Lophosiphonia</A>
<LI><A href = "${htmlpath}microdic.nn.html">Microdictyon</A>
<LI><A href = "${htmlpath}phloioca.nn.html">Phloiocaulon</A>
<LI><A href = "${htmlpath}rhodophy.nn.html">Rhodophyceae</A>
<LI><A href = "${htmlpath}stenocla.nn.html">Stenocladia</A>
<LI><A href = "${htmlpath}stilopho.nn.html">Stilophora</A>
</UL>
</body>
</html>
EOP
close(HOME);

open(HOME,">${htmloutpath}ioccomb.html") || die "couldnt open output file for combs\n";
print HOME <<EOP;
<html>
<head>
<title> New combinations and names</title>
</head>
<body>
<H1>INDEX TO NEW COMBINATIONS AND NEW NAMES</H1>
<UL>
EOP
foreach(sort(keys(%cnov))){
print HOME "<LI> $cnov{$_}$_</a>\n";
}
print HOME "</UL>\n</body>\n</html>\n";
close(HOME);

open(HOME,">${htmloutpath}iocexclu.out.html") || die "couldnt open output file for excluded recs\n";
print HOME <<EOP;
<html>
<head>
<title> Excluded records</title>
</head>
<body>
<H1>INDEX TO EXCLUDED RECORDS AND NAMES OF UNCERTAIN APPLICATION</H1>
<UL>
EOP
foreach(sort(keys(%exclu))){
print HOME "<LI> $exclu{$_}$_</a>\n";
}
print HOME "</UL>\n</body>\n</html>\n";
close(HOME);

$outfile = "${htmloutpath}splist_ndx.html";
open(HOME, ">$outfile") || die "couldn't open $outfile\n";
print HOME <<EOP;
<html>
<head>
<title> Index to locations </title>
</head>
<body>
<H1> LOCALITIES FOR WHICH SPECIES LISTS HAVE BEEN GENERATED</H1>
<UL>
EOP

foreach(sort(keys(%loclist))){
$outfile = "\L${htmlpath}$_.html\E";
$outfile =~ s/ /_/g;
print HOME <<EOP;
<LI>
<a href = "$outfile">$_</a>
EOP
}
print HOME "</UL>\n</body>\n</html>\n";
close(HOME);

foreach $ioloc (sort (keys (%loclist))){
($FN = $ioloc) =~ s/ /_/g;
$outfile = "\L${htmloutpath}$FN.html\E";
open (OUTFILE, ">$outfile") || die "couldn't open $outfile\n";
print OUTFILE <<EOHEAD;
<html>
<head>
<title> $outfile</title>
</head>
<body>
<H1> ALGAE RECORDED FROM \U$ioloc\E (alphabetical order)</H1>
EOHEAD

&sortedlinks($loclist{$ioloc});
print OUTFILE "\n</body>\n</html>\n";
close(OUTFILE);
}

open(HOME,">${htmloutpath}iocbib.html") || die "couldnt open bib index file\n";
print HOME <<EOH;

<html>
<head>
<TITLE>Indian Ocean Catalogue Index to Authors</TITLE>
</head>
<body>
<H1>INDEX TO FIRST AUTHORS</H1>
<UL>
EOH
foreach $aut (@auttag){
print HOME "<LI>$aut\n";
}
print HOME "</UL>\n";
print HOME "</body>\n</html>\n";
close(HOME);

open(RECFILE,"/users/rlmoe/ioc/nn/reconcil.c") || die "couldn't open it\n";
open(HOME,">${htmloutpath}reconcil.html") || die "couldnt open recon file\n";
undef($/);
print HOME "<HTML><HEAD><TITLE>Reconciliation with Drouetian system</TITLE></HEAD><BODY>\n";
#massage troff input
while(<RECFILE>){
	s#[^\000]+RECONCIL#<H1>RECONCIL#;
	s#\.DE#</H1>#;
	s#\.Dn#</DL><DL><DT>#g;
	s#\.In#<DD>#g;
	s#\.sp#<p>#g;
	s#\\f2#<EM>#g;
	s#\\f1#<\/EM>#g;
	s#\.Op(\n.*\n)\.Fp(\n.*\n)</DL>#</DL><H2>$1<p>$2</H2>#g;
	s#\.Fp(\n.*\n)</DL>#</DL><H2>$1</H2>#g;
	s#</DL>##; #get rid of first one
	s#<DL>#<DL compact>#g;

foreach( split("\n",$_)){
	$_ = &htmltrans($_);
#($name = $_) =~ s/<.?EM>//g;
($name) = m/<EM>(.*)<\/EM>/;
$name =~ s/<\/EM>.* (forma|subsp.|var.) <EM>/ $1 /;
if($reconcil{$name}){
s#(<EM.*)#<a name = "$name" $reconcil{$name} >$_</A>#;
}
	print HOME "$_\n";
	}
}
print  HOME "</DL></body>\n</html>\n";
$/ = "\n";
close(HOME);

#make table of contents page
open(HOME,">${htmloutpath}ioctoc.html");
print HOME <<EOH;
<html>
<head>
<title> Indian Ocean Benthic Algae</title>
</head>
<body>
<H1> CATALOGUE OF BENTHIC MARINE ALGAE OF THE INDIAN OCEAN</H1>
<strong>Paul C. Silva<br>Philip Basson<br>Richard Moe<br></strong>
<HR>
<UL>
<LI><A HREF="${htmlpath}abstract.out.html">Abstract</A>
<LI><A HREF="${htmlpath}gfp2.unx.html">History of Indian Ocean Phycology (by G.F. Papenfuss)</A>
<LI><A HREF="${htmlpath}about.html">About the Catalogue</A>
<LI><A HREF="${htmlpath}about_html.html">About the HTML version</A>
<LI><A HREF="${htmlpath}scope.html">Scope and format of the Catalogue</A>
<LI><A HREF="${htmlpath}ioccat.html">Alphabetical index to genera</A>
<LI><A HREF="${htmlpath}iocphyl.html">Index to genera (Catalogue order)</A>
$species_nx
<LI><A HREF="${htmlpath}iocbib.html">Index to bibliography</A>
<LI><A HREF="${htmlpath}iocnn.html">Index to nomenclatural notes</A>
<LI><A HREF="${htmlpath}ioccomb.html">Index to new combinations</A>
<LI><A HREF="${htmlpath}iocexclu.out.html">Index to excluded records</A>
<LI><A HREF="${htmlpath}splist_ndx.html">Geographical index</A>
<LI><A HREF="${htmlpath}reconcil.html">Cyanophyceae according to the Drouetian system</A>
</UL>
<HR>
<address>
Richard Moe
<br>
Herbarium, University of California
<br>
Berkeley, CA 94720-2465
<br>
510-643-7007  rlmoe@ucjeps.herb.berkeley.edu
</address>
rev.: $date 
<br>
copyright $year Regents of the University of California
</body>
</html>
EOH
close(HOME);

dbmclose(%csname);

sub sortedlinks {
@quadlist = split(/\t/,$_[0]);
@quadlist = sort by_name (@quadlist);
foreach $quad (@quadlist){
if($csname{$quad}){
print OUTFILE qq
<a HREF = "$getent?$quad">$csname{$quad}</A><br>\n
;
}
else { warn "sortedlinks cant find name for $quad\n"; }
}
}

sub printtitle {
local ($title) = @_;
print HTMLFILE "<HTML>\n<HEAD>\n<TITLE> $title </TITLE>\n</HEAD>\n<BODY>\n";
}
#location codes for dynamic map
sub loadcode {
	local($startcode) = $_[0];
open (CODES, "locassoc.pdb") || die "couldnt load distribution codes\n";
	while(<CODES>){
	$acode = sprintf("%c", $startcode++);
	chop;
	($loc,$lat,$long) = split("\t");
# necessary for encoder
	$loc{$loc} = $acode;
	#$loc{$acode} = $loc;
#necessary for decoder
	#$lat{$acode} = $lat;
	#$long{$acode} = $long;
	}
}

sub hclose {
$closefile = "</BODY>\n</HTML>\n";
$closefile;
}
sub by_name{ $csname{$a} cmp $csname{$b};}
#foreach (sort (keys (%csname))){
#print "$_\t$csname{$_}\n";
#}
sub htmltrans {
	local($_) = @_;
	s/\.ds.*//;
	s/\\\|\?/?/g;
	s/&/&amp;/g;
#this will fail at \f2anything\f1 else \f3something\f1 else
	while(s/\\f3/<STRONG>/){ s/\\f[1P]/<\/STRONG>/;}
	while(s/\\f2/<EM>/){
		die "mismatched font request in $file:$.\n" unless s/\\f[1P]/<\/EM>/;
		}
	s/\.[PL]P/<P>\n/g;
s/\.Ts/<P>/g;
s/\.Sy/<P>/g;
s/\.Pe/<P>/;
s/\.Id/<P>INDIAN OCEAN DISTRIBUTION:/;
	s/\\\*Q/``/g;
	s/\\\*U/''/g;
s/\\\|//g;
s/\\&//g;
s/\\\^/ /g;
	s/\\+\*\(dl/l/g;
s/\\\*\(og//g;
	s/\w\\+\*[^(]/$htmlacc{$&}/g;
s/(.)\\+\*\^/&$1circ;/g;
	s/\\\(\*(.)/$1/g;
	s/\\\(AE/&AElig;/g;
	s/\\\(ae/ae/g;
s/\.\s*\\".*\n//g;
s/\\\(ts/s/g;
#eliminate left-over accents
s/\\\*.//g;
s/\\\(..//g;
	s/\.sp.*/<p>/g;
	s/\.ti.*/<p>/g;
	s/\.br/<br>/g;
	s/\.bp/<br>/g;
	s/\.Qp/<P><blockquote>/g;
	s/\.Qc/<\/blockquote>/g;
s/^\.NX.*\n//g;
s/^\.in.*//g;
	s/\.DS C/<P><strong>/g;
	s/\.DE/<\/strong><P>/g;
	s/\.D[^t]/<p>/g;
	s/\\\*\*//g;
#need to eliminate local motions: \u\d as well as size changes
s/\\s[+-]\d//g;
s/\\[ud]//g;
	$_;
}
__END__
z\*v	z
y\*'	&yacute;
u\\*:	&uuml;
u\*`	&ugrave;
u\*^	&ucirc;
u\*:	&uuml;
u\*'	&uacute;
s\*v	s
s\*'	s
r\*v	r
o\\*:	&ouml;
o\\*/	&oslash;
o\\*.	o
o\*~	&otilde;
o\*`	&ograve;
o\*_	o
o\*^	&ocirc;
o\*:	&ouml;
o\*/	&oslash;
o\*.	o
o\*'	&oacute;
n\\*~	&ntilde;
n\\*'	n
n\*~	&ntilde;
n\*:	n
n\*'	n
l\*-	l
i\\*`	&igrave;
i\\*'	&iacute;
i\*`	&igrave;
i\*^	&icirc;
i\*:	&iuml;
i\*'	&iacute;
e\\*`	&egrave;
e\\*:	&euml;
e\\*'	&eacute;
e\*v	e
e\*`	&egrave;
e\*^	&ecirc;
e\*:	&euml;
e\*.	e
e\*'	&eacute;
c\\*'	c
c\*v	c
c\*,	&ccedil;
c\*'	c
a\\*~	&atilde;
a\\*o	&aring;
a\\*`	&agrave;
a\\*:	&auml;
a\\*.	a
a\\*'	&aacute;
a\*~	&atilde;
a\*o	&aring;
a\*`	&agrave;
a\*^	&acirc;
a\*:	&auml;
a\*.	a
a\*'	&aacute;
Z\*v	Z
U\*:	&Uuml;
S\*v	S
O\*:	&Ouml;
O\*/	&Oslash;
I\*^	&Icirc;
E\*'	&Eacute;
C\*v	C
A\*o	&Aring;
A\*`	&Aacute;