)
$page=~s|\<\s*\/h1\s*\>||i
or die "no heading for $stub\n";
my $head=$`;
$page=$';
my $site_name = "Haifux - Haifa Linux Club";
my $title = (($head eq $site_name) ? $site_name : "$site_name - $head");
#title cannot have any tags inside it, but we may need tags for redirection
$title=~s/\<[^\>]*\>//g;
print "$stub, $head\n";
my $outline=$outline_base;
my $is_hebrew=($html=~/hebrew\//);
my $other_language;
my $direct_to_other_language;
if ($is_hebrew){
$other_language='../'.$POSTMATCH;
$direct_to_other_language="This page in English";
$page="\
$page\<\/div\>";
$head="\
$head\<\/div\>";
}else{
$other_language='hebrew/'.$html;
$direct_to_other_language="דף זה בעברית";
}
my $link_to_other_language='
'.
$direct_to_other_language.'';
$outline=~s/LinkToThisPageInOtherLanguage/$link_to_other_language/;
$outline=~s/InsertTextHere/$page/;
$outline=~s/InsertHeadHere/$head/;
$outline=~s/InsertTitleHere/$title/;
if($is_hebrew) {
$outline=~s/>[^<]+/>
$1<\/span>/g;
}
$outline=~s/RedUpdate/$RedUpdate/g;
$outline=~s/PinkUpdate/$PinkUpdate/g;
#Find examples, and convert them to text by inserting
before each \n
while ($outline=~/BeginExampleHere/){
my $before=$PREMATCH;
my $rest=$POSTMATCH;
($rest=~/EndExampleHere/) or die "example begun but not ended on $stub\n";
my $after=$POSTMATCH;
my $example=$PREMATCH;
$example=~s/\n/\
\n/g;
$outline=$before.$example.$after;
}
my $outname = "$outdir/$html";
open(OUT,">$outname") || die ("can't open output file $outname - $!");
print OUT $outline;
close(OUT);
}