-MATCH: foreach $key (keys %DB) {
- $parent=$PARENT{$key};
- $parent=$key if (!defined $parent);
- $ref=$DB{$key}{"Notes"};
- next MATCH if (!defined $ref);
- $ref=~tr/()//d;
- $ref=~s/^=//;
- $ref=~s/^O\. *//i;
- $ref=~s/^Orchidaceae *//i;
- $ref=~s/\..*$//;
- next MATCH if &try_reparent();
- $ref=$DB{$key}{"Rank"}." $ref" if exists $DB{$key}{"Rank"};
- next MATCH if &try_reparent();
- $ref=$DB{$key}{"Genus"}." $ref" if exists $DB{$key}{"Genus"};
- next MATCH if &try_reparent();
+if (defined $maxsize) {
+ my($fileno)=-1;
+ my($filename,$fileid);
+ foreach $owner (sort keys %OWNS) {
+ my( $child );
+
+ if ($fileno<0 || tell(OUT)>=$maxsize) {
+ OUT_flush() if ($fileno>=0);
+ $fileid=sprintf("%04d",++$fileno);
+ $filename="kew-$fileid.html";
+ open(OUT,">$filename") or die "Cannot open \"$filename\": $!";
+ print_header("chunk $fileid");
+ }
+
+ if ($debugmatch) {
+ print STDERR "($owner):";
+ foreach $child (@{$OWNS{$owner}})
+ { print STDERR " ($child)"; }
+ print STDERR "\n";
+ }
+ print OUT format_record("<p><a id=\"".htmlquote($owner)."\">","</a></p>\n",%{$DB{$owner}});
+ if (@{$OWNS{$owner}}) {
+ print OUT "<blockquote>\n";
+ foreach $child (@{$OWNS{$owner}})
+ { print OUT format_record("<p>","</p>\n",%{$DB{$child}}); }
+ print OUT "</blockquote>\n";
+ }
+ print OUT "\n";
+ $DB{$owner}{"_filename"}=$filename;
+ }
+ OUT_flush();
+ open(OUT,">kew-index.html") or die "Cannot open \"kew-index.html\": $!";
+ print_header("Index");