/\n/isg;
my @orig = map { "$_\n" } split(/\n/,$orig);
# build the index
warn "Building index data\n";
my %anchor2page;
my @titles;
my @subtitles;
my $i = 0;
for(@orig) {
# print $_;
if (/]+>(.+?)<\/A>/) {
$i++;
$titles[$i] = $1;
$subtitles[$i] = [];
}
if (/(.+?)<\/A><\/H2>/) {
push @{$subtitles[$i]},[$1,$2];
}
if (/(.+?)<\/A>/) {
$anchor2page{$1} = "$basename$i.shtml?#$1";
}
s///ig;
}
warn "Building pages\n";
# loop over file again and make pages
my $template = '';
my $csslink = qq(
);
#get first part;
while (@orig) {
local $_ = shift @orig;
$_ .= $csslink if /<\/HEAD>/i;
$template .= $_;
last if //;
}
$template .= qq{
| \\X/ Web programming |
|---|
| Index | ||
|---|---|---|
| \">$titles[$tnum] | ||
\" width=8 height=16 border=0> | #$subtitle->[0]\">$subtitle->[1] | |
| ">[CSS ON] ?nocss">[CSS OFF] | ||
| $index | $navbar$title$filedata$navbar
|