2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2024-11-22 02:59:49 +00:00

commandref_join.pl: fix some name/id problems (Forum #122160)

git-svn-id: https://svn.fhem.de/fhem/trunk@24801 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2021-07-26 11:49:46 +00:00
parent 55f6c9eaa4
commit 1185ca2abb
3 changed files with 10 additions and 15 deletions

View File

@ -79,7 +79,7 @@ sub
chkAndGenLangLinks($$$)
{
my ($l, $lang, $fh) = @_;
$var = $1 if($l =~ m/<a name="(.*?)"(.*?)><\/a>/);
$var = $2 if($l =~ m/<a (name|id)="(.*?)".*><\/a>/);
if($fh && $l =~ m/(.*?)<\/h3>/ && $var) {
print $fh "<div class='langLinks'>[".join(" ", map {
$_ eq $lang ? $_ :
@ -112,7 +112,7 @@ foreach my $lang (@lang) {
# Second run: create the file
while(my $l = <IN>) { # Header
last if($l =~ m/name="perl"/);
last if($l =~ m/(name|id)="perl"/);
print OUT $l;
chkAndGenLangLinks($l, $lang, \*OUT);
@ -125,7 +125,7 @@ foreach my $lang (@lang) {
}
# Copy the tail
print OUT '<a name="perl"></a>',"\n";
print OUT '<a (name|id)="perl"></a>',"\n";
$var = "perl";
while(my $l = <IN>) {
@ -186,8 +186,7 @@ generateModuleCommandref($$;$$)
$docCount++;
next if($noWarnings);
$hasLink = ($l =~ m/<a name="$mod"/) if(!$hasLink);
$hasLink = ($l =~ m/<a id="$mod"/) if(!$hasLink);
$hasLink = ($l =~ m/<a (name|id)="$mod"/) if(!$hasLink);
foreach $tag (TAGS) {
if($l =~ m/<$tag ([^>]+)>/i) {
my $attr = $1;
@ -217,7 +216,7 @@ generateModuleCommandref($$;$$)
if(!$jsFile && $suffix && !$docCount && !$dosMode) {
if($lang eq "DE" && $fh) {
print $fh <<EOF;
<a name="$mod"></a>
<a id="$mod"></a>
<h3>$mod</h3>
<ul>
Leider keine deutsche Dokumentation vorhanden. Die englische Version gibt es

View File

@ -85,10 +85,8 @@ for my $lang (@lang) {
push @lang,($1 eq "" ? "EN":substr($1,1)) if($l =~ m/^=begin html(.*)/);
$modData{$mName}{type}=$1 if($l =~ m/^=item\s+(helper|command|device)/);
$modData{$mName}{$1} =$2 if($l =~ m/^=item\s+(summary[^ ]*)\s(.*)$/);
$modData{$mName}{modLinks}{$1} = 1
if($l =~ m/<a\s+name=['"]([^ '"]+)['"]>/);
$modData{$mName}{modLinks}{$1} = 1
if($l =~ m/<a\s+id=['"]([^ '"]+)['"]>/);
$modData{$mName}{modLinks}{$2} = 1
if($l =~ m/<a\s+(name|id)=['"]([^ '"]+)['"]>/);
}
$modData{$mName}{modLangs} = join(",", @lang);
close(FH);
@ -101,7 +99,7 @@ for my $lang (@lang) {
$cmdref = ">docs/commandref${sfx}.html";
open(OUT, $cmdref) || die("Cant open $cmdref: $!\n");
my $linkDumped = 0;
while(my $l = <IN>) {

View File

@ -96,10 +96,8 @@ for my $lang (@lang) {
push @lang,($1 eq "" ? "EN":substr($1,1)) if($l =~ m/^=begin html(.*)/);
$modData{$mName}{type}=$1 if($l =~ m/^=item\s+(helper|command|device)/);
$modData{$mName}{$1} =$2 if($l =~ m/^=item\s+(summary[^ ]*)\s(.*)$/);
$modData{$mName}{modLinks}{$1} = 1
if($l =~ m/<a\s+name=['"]([^ '"]+)['"]>/);
$modData{$mName}{modLinks}{$1} = 1
if($l =~ m/<a\s+id=['"]([^ '"]+)['"]>/);
$modData{$mName}{modLinks}{$2} = 1
if($l =~ m/<a\s+(name|id)=['"]([^ '"]+)['"]>/);
}
$modData{$mName}{modLangs} = join(",", @lang);
close(FH);