2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 06:48:43 +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($$$) chkAndGenLangLinks($$$)
{ {
my ($l, $lang, $fh) = @_; 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) { if($fh && $l =~ m/(.*?)<\/h3>/ && $var) {
print $fh "<div class='langLinks'>[".join(" ", map { print $fh "<div class='langLinks'>[".join(" ", map {
$_ eq $lang ? $_ : $_ eq $lang ? $_ :
@ -112,7 +112,7 @@ foreach my $lang (@lang) {
# Second run: create the file # Second run: create the file
while(my $l = <IN>) { # Header while(my $l = <IN>) { # Header
last if($l =~ m/name="perl"/); last if($l =~ m/(name|id)="perl"/);
print OUT $l; print OUT $l;
chkAndGenLangLinks($l, $lang, \*OUT); chkAndGenLangLinks($l, $lang, \*OUT);
@ -125,7 +125,7 @@ foreach my $lang (@lang) {
} }
# Copy the tail # Copy the tail
print OUT '<a name="perl"></a>',"\n"; print OUT '<a (name|id)="perl"></a>',"\n";
$var = "perl"; $var = "perl";
while(my $l = <IN>) { while(my $l = <IN>) {
@ -186,8 +186,7 @@ generateModuleCommandref($$;$$)
$docCount++; $docCount++;
next if($noWarnings); next if($noWarnings);
$hasLink = ($l =~ m/<a name="$mod"/) if(!$hasLink); $hasLink = ($l =~ m/<a (name|id)="$mod"/) if(!$hasLink);
$hasLink = ($l =~ m/<a id="$mod"/) if(!$hasLink);
foreach $tag (TAGS) { foreach $tag (TAGS) {
if($l =~ m/<$tag ([^>]+)>/i) { if($l =~ m/<$tag ([^>]+)>/i) {
my $attr = $1; my $attr = $1;
@ -217,7 +216,7 @@ generateModuleCommandref($$;$$)
if(!$jsFile && $suffix && !$docCount && !$dosMode) { if(!$jsFile && $suffix && !$docCount && !$dosMode) {
if($lang eq "DE" && $fh) { if($lang eq "DE" && $fh) {
print $fh <<EOF; print $fh <<EOF;
<a name="$mod"></a> <a id="$mod"></a>
<h3>$mod</h3> <h3>$mod</h3>
<ul> <ul>
Leider keine deutsche Dokumentation vorhanden. Die englische Version gibt es 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(.*)/); 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}{type}=$1 if($l =~ m/^=item\s+(helper|command|device)/);
$modData{$mName}{$1} =$2 if($l =~ m/^=item\s+(summary[^ ]*)\s(.*)$/); $modData{$mName}{$1} =$2 if($l =~ m/^=item\s+(summary[^ ]*)\s(.*)$/);
$modData{$mName}{modLinks}{$1} = 1 $modData{$mName}{modLinks}{$2} = 1
if($l =~ m/<a\s+name=['"]([^ '"]+)['"]>/); if($l =~ m/<a\s+(name|id)=['"]([^ '"]+)['"]>/);
$modData{$mName}{modLinks}{$1} = 1
if($l =~ m/<a\s+id=['"]([^ '"]+)['"]>/);
} }
$modData{$mName}{modLangs} = join(",", @lang); $modData{$mName}{modLangs} = join(",", @lang);
close(FH); close(FH);

View File

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