) {
print OUT $l;
chkAndGenLangLinks($l, $lang, \*OUT);
}
close(OUT);
}
#############################
# read a module file and check/print the commandref
sub
generateModuleCommandref($$;$$)
{
my ($mod, $lang, $fh, $jsFile) = @_;
my $fPath = $mods{$mod} ? $mods{$mod} : $mod;
my $tag;
my $suffix = ($lang eq "EN" ? "" : "_$lang");
my %tagcount= ();
map { $tagcount{$_} = 0 } TAGS;
my %llwct = (); # Last line with closed tag
my $modFh;
open($modFh, $fPath) || die("Cant open $fPath:$!\n");
my $skip = 1;
my $line = 0;
my $docCount = 0;
my $hasLink = 0;
my $dosMode = 0;
while(my $l = <$modFh>) {
$line++;
$dosMode = 1 if($l =~ m/^=begin html$suffix.*\r/);
if($l =~ m/^=begin html$suffix$/) {
$l = <$modFh>; # skip one line, to be able to repeat join+split
print "*** $lang $mod: nonempty line after =begin html ignored\n"
if($l =~ m/^...*$/);
$skip = 0; $line++;
} elsif($l =~ m/^=end html$suffix$/) {
$skip = 1;
print $fh "" if($fh);
} elsif(!$skip) {
print $fh $l if($fh);
chkAndGenLangLinks($l, $lang, $fh);
$docCount++;
$hasLink = ($l =~ m//gi);
$tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi) if($tagcount{$tag} > 0);
$llwct{$tag} = $line if(!$tagcount{$tag});
}
if($l =~ m,INSERT_DOC_FROM: ([^ ]+)/([^ /]+) ,) {
my ($dir, $re) = ($1, $2);
if(opendir(DH, $dir)) {
foreach my $file (grep { m/^$2$/ } readdir(DH)) {
generateModuleCommandref("$dir/$file", $lang, $fh, 1);
}
closedir(DH);
}
}
}
}
close($modFh);
print "*** $lang $fPath: ignoring text due to DOS encoding\n"
if($dosMode);
# TODO: add doc to each $jsfile
print "*** $lang $fPath: No document text found\n"
if(!$jsFile && !$suffix && !$docCount && !$dosMode && $fPath !~ m,/99_,);
if(!$jsFile && $suffix && !$docCount && !$dosMode) {
if($lang eq "DE" && $fh) {
print $fh <
$mod
Leider keine deutsche Dokumentation vorhanden. Die englische Version gibt es
hier: $mod
EOF
}
}
print "*** $lang $fPath: No a-tag with name=\"$mod\" \n"
if(!$jsFile && !$suffix && $docCount && !$hasLink && !$noWarnings);
foreach $tag (TAGS) {
print("*** $lang $fPath: Unbalanced $tag ".
"($tagcount{$tag}, last line ok: $llwct{$tag})\n")
if($tagcount{$tag} && !$noWarnings);
}
}