my $page = shift;
my $buf = shift;
my $doBacks = $DoBacks;
- my $doAlt = 1;
my @links = ();
if ($page =~ /\/$/) {
@links = (@{$CatFiles{$page}}, @{$CatDirs{$page}});
$doBacks = 0;
- $doAlt = 0;
} elsif (exists $Links{noindex $page}) {
@links = @{$Links{noindex $page}};
}
makerels;
{
my $title = noindex $page;
- my $fn = basename $page;
+ my $fn = ($page =~ /\/$/) ? "index" : basename $page;
print $out "<!DOCTYPE html>
<html><head>
<title>$title</title>
-<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
- if ($doAlt) {
- print $out "\n<link rel=\"alternate\" type=\"text/plain\" title=\"src\" href=\"$fn.txt\" />";
- }
- print $out "\n</head>\n<body>\n<pre>";
+<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
+<link rel=\"alternate\" type=\"text/plain\" title=\"src\" href=\"$fn.txt\" />
+</head>
+<body>
+<pre>";
}
my $indent = "";
my sub procline;
my $now = time;
use File::Path qw(make_path);
use File::Copy;
+ my $fh;
+ my $fn;
foreach my $cat (keys %CatFiles) {
make_path "$ARGV[1]/$cat";
next if (exists $Mtimes{"${cat}index"});
- my $fn = "$ARGV[1]/${cat}index.html";
- open(my $fh, ">:encoding(UTF-8)", $fn) or die "$!";
+ $fn = "$ARGV[1]/${cat}index.txt";
+ open($fh, ">:encoding(UTF-8)", $fn) or die "$!";
+ genIndex $fh, $cat;
+ close $fh;
+ $fn = "$ARGV[1]/${cat}index.html";
+ open($fh, ">:encoding(UTF-8)", $fn) or die "$!";
genHTML $fh, $cat, genIndex2Buf $cat;
close $fh;
utime $now, $now, $fn;
}
+ my @s;
foreach my $pth (keys %Mtimes) {
- open(my $fh, ">:encoding(UTF-8)", "$ARGV[1]/$pth.html") or die "$!";
+ open($fh, ">:encoding(UTF-8)", "$ARGV[1]/$pth.html") or die "$!";
my $backsWereGenerated = genHTML $fh, $pth;
close $fh;
- my @s = stat($pth) or die "$!";
+ @s = stat($pth) or die "$!";
if ($backsWereGenerated) {
utime $now, $now, "$ARGV[1]/$pth.html";
} else {