### ### Link Table ### ### Produce a "Link Table" in the current location. ### ### Call with: ### #call LinkTable LINK.FILE BGCOLOR ### To represent a missing entry, pass in /dev/null. ### ### ### The LINK.FILE indicates which entries to put on the ### table. ### ### The BGCOLOR is a STRING like: BGCOLOR=#FFFFF ### ### sub LinkTable { local($args) = @_; local($prev, $next); local($basename, $fname, $linktable, $item, $last, $name, @names); local($bgcolor, $link, @links); # First find the previous and next information $prev = ""; $next = ""; ($linktable,$bgcolor) = split(/\s+/, $args); if ($linktable eq "") { print "Usage: #call LinkTable LINK.FILE BGCOLOR\n"; return; } #print "Before $pagelist $linktable\n"; print OUT " \n " ; $linktable = "$Directory/$linktable" if ($linktable !~ m#^/#); $linktable = CanonFname($linktable); # Find the pairs of URLs/description. if (!open(HB, "<$linktable")) { print "Cannot open linktable file $linktable \n"; } else { while () { chomp; next if (/^#/ || /^\s*$/); s/^\s*//; ($link, $name) = split(/\s+/, Expand($_), 2); next if (!defined(!$link)); push(@names, $name); push(@links, $link); } close HB; } # OK. We've now got all the information we are going to get. # It's time to emit the code. print OUT " \n" ; # print OUT "
\n"; # print OUT "\n"; # print OUT "\n" if ($prev ne ""); # print OUT "\n" if ($next ne ""); for ($item = 0; $item <= $#names; $item++) { $basename = $names[$item]; $basename =~ s/\.[^.]*$//; # if (($Symbols{'__FILE__'} =~ m#/$basename#) || # ($Symbols{'__FILE__'} =~ m#^$basename#)) # { # print OUT "[$links[$item]]\n"; # } # else { $basename = $links[$item]; $basename .= ".html" if ($basename !~ /\./); print OUT "\n"; } } # print OUT "
\n"; # print OUT "\n"; print OUT "
$Symbols{'__HR__'}
Previous
Next
$names[$item] $links[$item]
$Symbols{'__HR__'}
\n" ; } return 1 ;