$tpl[0] =~ s#(</title>)#$title$1$after_title#is;
$tpl[0] =~ s#(<body\b)#$1$body_attrs#is if $body_attrs;
my $top = File::Spec::Unix->abs2rel('', $textdir);
+ print "top=$top\n";
+ $top = "" if ($top eq '/');
$top .= "/" if length($top);
my $result = join('', $tpl[0], $body, $tpl[1]);
$result =~