EOT
}
else { # impossible case - Class was set.
print "$center\n"
unless $Width eq '100%';
}
# Old WDVL style had 'gold bar' banner linked to /Index.html
$Index = "Index.html" unless $url eq "/Index.html";
# WDVL banner (old style)
# -----------
print <
$_center
EOT
&TopLeft if $Class eq 'Morey';
&Banner if $banner && ($Class ne 'NavMar');
&BotRight if $Class eq 'Morey';
print <
EOT
# Title, Author, PubDate, Abstract
# --------------------------------
print "$center $Title $_center\n"
unless (($v{'url'} =~ /Vlib\//) # Vlib puts own title
&& !($v{'url'} =~ /Vlib\/New.html/))
|| ($v{'Heading'} eq 'No')
;
print "$center $_center"
if $Author;
print "$center $v{'PubDate'} $_center"
if $v{'PubDate'};
# Abstract
# --------
print <
$center
$_center
EOT
print " \n"; # To apply CSS to first paragraph.
print "<\!--content_start-->\n";
}
# ________________________________________________________________
sub Foot { # Append standard Foot to HTML file.
# ________________________________________________________________
$File = 'ht' unless $File;
$Version= '0.5 BETA' unless $Version;
$SWP = "$WDVL/Software/Perl";
$bghead = "#cccccc";
$bgcell = "#cccccc";
($date, $time) = &datime;
&URL ;
print "\n";
if ($Class eq 'NavMar') { # Right-hand Navigation Margin
open (XX, ") { print ; }
close (XX);
print " ";
}
else {
print <
EOT
print " | " unless $v{'Width'} eq '100%';
}
print "$center\n";
print <Home
EOT
@levels = split('/',$v{'url'});
$ll = $#levels;
$ll-- if ($levels[$ll] eq 'index.html');
for ($i=1;$i<$ll;$i++) {
$urlev .= $levels[$i] . '/';
print " / $levels[$i]";
}
print "$_center\n";
&TopLeft if $Class eq 'Morey';
if ($Class eq 'NavMar') { # internet.com navbar
open (XN, ") { print ; }
close (XN);
print " ";
# }
print # bottom banner ad
"$center";
}
# Old style had a navbar of gold buttons..
print <
$center
EOT
print <
EOT
&BotRight if $Class eq 'Morey';
print "";
undef %v;
}
# ________________________________________________________________
sub datime { # Return current date and time.
# ________________________________________________________________
@days = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@mons = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
'Sep', 'Oct', 'Nov', 'Dec');
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime(time);
# $mon = $mons[$mon];
$mon = $mon + 1;
if ($mon =~ /\d/)
{$mod =~ s/(\d)/0$1/;}
if ($mday =~ /\d/)
{$mday =~s/(\d)/0$1/;}
$year = $year + 1900;
("$year-$mon-$mday","$hour:$min:$sec");
}
# ________________________________________________________________
sub GetTitle{ # Get title from HTML file.
# ________________________________________________________________
local ($titonly) = @_;
undef $hn;
undef $title;
$t = $h = 0;
while () {
chop ;
if (//i) {
$t = !/<\/Title>/i;
$title = $_;
last if $titonly && /<\/Title>/i;;
last if $file =~ /3d/; #?
last if $file =~ /Vlib/;
}
elsif (/<\/Title>/i) {
$title .= $_;
# return if $titonly;
$t = 0;
}
elsif (//i) {
$h = !/<\/H\d>/i;
$hn = $_;
last if !$h;
}
elsif (/<\/H\d>/i) {
$hn .= $_;
last;
}
elsif ($t) {
$title .= $_;
}
elsif ($h) {
$hn .= $_;
}
}
if ($hn) {
$title = $hn;
}
elsif ($title) {
}
else {
$title = $file;
}
$title =~ s/WDVL://;
$title =~ s/^\s*//;
$title =~ s/\s*$//;
$title =~ s/<[^>]+>//g;
$title =~ s/[^>]+>//g;
return $title;
}
# ________________________________________________________________
sub URL { # Determine URL of current file.
# ________________________________________________________________
if (!$v{'url'}) {
if ($v{'File'} =~ /\//) {
# Running from top of web tree
@file = split (/\//, $v{'File'});
$file = $file [$#file];
$dir = $file [$#file-1];
$URL = "/" . $v{'File'};
$v{'url'} = "$URL.html";
}
else {# Running from same dir.
$_ = $ENV{'PWD'};
split (/\//);
$dir = $_[$#_];
until ($shft_cnt > $shft) {
shift (@_);
$shft_cnt++;
}
$URL = join ('/',@_) ;
$URL = "/" . $URL if $URL;
$v{'file'} = 'index' if !$v{'file'};
$v{'url'} = "$URL/$v{'file'}.html";
}
if (!$v{'Title'}) {
$v{'Title'} = $v{'file'};
$v{'Title'} = $dir
if $v{'file'} eq 'index';
}
}
if (!$v{'URL'}) {
$v{'URL'} = $base . "$v{'url'}";
}
$URL = $v{'URL'}; # complete, absolute URL
$url = $v{'url'}; # relative URL (path and file name)
}
# ________________________________________________________________
sub Banner { # Ad banner
# ________________________________________________________________
$banner = $v{'Banner'};
return if ($banner =~ /^None$/i);
print <
EOT
$banner = <
EOT
print "$center\n$banner\n$_center\n";
$v{'Banner'} = $banner;
}
# ________________________________________________________________
sub Macros { # Prev/Up/Next buttons
# ________________________________________________________________
if (/\@Prev\s*\(([^)]*)\)/) {
$title = &getTitle($1) ;
print <
$title
EOT
$_ = "";
}
if (/\@Up\s*\(([^)]*)\)/) {
$title = &getTitle($1) ;
print <$title
EOT
$_ = "";
}
if (/\@Next\s*\(([^)]*)\)/) {
$title = &getTitle($1) ;
print <$title
EOT
$_ = "";
}
# s|\@Up\s*\(([^)]*)\)| |ig;
# s|\@Next\s*\(([^)]*)\)| |ig;
# s|\@Prev\s*\(([^)]*)\)| |ig;
s|\@Drop\s*\((.*)\)||ig;
s|\@href\s*\(([^,]*),([^)]*)\)|$2|ig;
s|\@banner\s*\((.*)\)| |