2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

commandref: add more language links (Forum #81087)

git-svn-id: https://svn.fhem.de/fhem/trunk@15629 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-12-17 12:16:50 +00:00
parent 155d6a32fd
commit ac34b6cce5
4 changed files with 25 additions and 9 deletions

View File

@ -74,6 +74,20 @@ printList($)
last; last;
} }
} }
my $var;
sub
chkAndGenLangLinks($$$)
{
my ($l, $lang, $fh) = @_;
$var = $1 if($l =~ m/<a name="(.*?)"(.*?)><\/a>/);
if($l =~ m/(.*?)<\/h3>/ && $var) {
print $fh "<div class='langLinks'>[".join(" ", map {
$_ eq $lang ? $_ :
"<a href='commandref".($_ eq "EN" ? "":"_$_").".html#$var'>$_</a>"
} @lang) . "]</div>\n";
$var = undef;
}
}
foreach my $lang (@lang) { foreach my $lang (@lang) {
my $suffix = ($lang eq "EN" ? "" : "_$lang"); my $suffix = ($lang eq "EN" ? "" : "_$lang");
@ -100,6 +114,8 @@ foreach my $lang (@lang) {
while(my $l = <IN>) { # Header while(my $l = <IN>) { # Header
last if($l =~ m/name="perl"/); last if($l =~ m/name="perl"/);
print OUT $l; print OUT $l;
chkAndGenLangLinks($l, $lang, \*OUT);
printList($1) if($l =~ m/<!-- header:(.*) -->/); printList($1) if($l =~ m/<!-- header:(.*) -->/);
} }
@ -110,8 +126,11 @@ foreach my $lang (@lang) {
# Copy the tail # Copy the tail
print OUT '<a name="perl"></a>',"\n"; print OUT '<a name="perl"></a>',"\n";
$var = "perl";
while(my $l = <IN>) { while(my $l = <IN>) {
print OUT $l; print OUT $l;
chkAndGenLangLinks($l, $lang, \*OUT);
} }
close(OUT); close(OUT);
} }
@ -147,15 +166,11 @@ generateModuleCommandref($$;$$)
} elsif($l =~ m/^=end html$suffix$/) { } elsif($l =~ m/^=end html$suffix$/) {
$skip = 1; $skip = 1;
print $fh "<p>" if($fh);
} elsif(!$skip) { } elsif(!$skip) {
print $fh $l if($fh); print $fh $l if($fh);
if($l =~ m,<h3>$mod</h3>,i && $fh) { chkAndGenLangLinks($l, $lang, $fh);
print $fh "<div class='langLinks'>".join(" ", map {
$_ eq $lang ? $_ :
"<a href='commandref".($_ eq "EN" ? "":"_$_").".html#$mod'>$_</a>"
} @lang) . "</div>\n";
}
$docCount++; $docCount++;
$hasLink = ($l =~ m/<a name="$mod"/) if(!$hasLink); $hasLink = ($l =~ m/<a name="$mod"/) if(!$hasLink);

View File

@ -18,7 +18,6 @@
<div id="logo"></div> <div id="logo"></div>
<div id="menu"> <div id="menu">
<h3>fhem.pl reference</h3> <h3>fhem.pl reference</h3>
Version: <b>EN</b>&nbsp;<a href="commandref_DE.html">DE</a>
<br><br> <br><br>
<a href="#doctop">Scroll to top</a> <a href="#doctop">Scroll to top</a>
<br><br> <br><br>

View File

@ -18,7 +18,6 @@
<div id="logo"></div> <div id="logo"></div>
<div id="menu"> <div id="menu">
<h3>fhem.pl Referenz</h3> <h3>fhem.pl Referenz</h3>
Version: <a href="commandref.html">EN</a>&nbsp;<b>DE</b>
<br><br> <br><br>
<a href="#doctop">Zum Anfang</a> <a href="#doctop">Zum Anfang</a>
<br><br> <br><br>

View File

@ -27,13 +27,16 @@ tr.column > td { padding:0; vertical-align:top;}
.col2 { text-align:center; } .col2 { text-align:center; }
/* Documentation */ /* Documentation */
h2,h3,h4 { color:#52865D; line-height:1.3; h2,h4 { color:#52865D; line-height:1.3;
margin-top:1.5em; font-family:Arial,Sans-serif; }
h3 { display: inline; color:#52865D; line-height:1.3;
margin-top:1.5em; font-family:Arial,Sans-serif; } margin-top:1.5em; font-family:Arial,Sans-serif; }
div.dist { padding-top:0.3em; } div.dist { padding-top:0.3em; }
button.dist { margin:10px; background:transparent; border:0px; cursor:pointer; } button.dist { margin:10px; background:transparent; border:0px; cursor:pointer; }
div.block { border:1px solid gray; background: #F8F8E0; padding:0.7em; } div.block { border:1px solid gray; background: #F8F8E0; padding:0.7em; }
#right { position:absolute; top:20px; left:180px; bottom:5px; right: 5px; } #right { position:absolute; top:20px; left:180px; bottom:5px; right: 5px; }
.langLinks { font-size: 0.6em; }
/* Widgets */ /* Widgets */
.makeTable { display:inline; float:left; clear:left; /*detail-selector,slider*/ .makeTable { display:inline; float:left; clear:left; /*detail-selector,slider*/