From d7f2b3fb556dfcebd2254d030703b6339b726279 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sat, 16 Jan 2016 19:27:21 +0000 Subject: [PATCH] contrib/commandref_join.pl: allow for =item helper type tags (Forum #47550) git-svn-id: https://svn.fhem.de/fhem/trunk@10530 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 1 + fhem/FHEM/90_at.pm | 1 + fhem/FHEM/91_eventTypes.pm | 1 + fhem/FHEM/91_notify.pm | 1 + fhem/FHEM/91_sequence.pm | 1 + fhem/FHEM/91_watchdog.pm | 1 + fhem/FHEM/92_FileLog.pm | 1 + fhem/FHEM/93_FHEM2FHEM.pm | 1 + fhem/FHEM/95_holiday.pm | 1 + fhem/FHEM/96_allowed.pm | 1 + fhem/FHEM/98_CULflash.pm | 1 + fhem/FHEM/98_JsonList2.pm | 2 +- fhem/FHEM/98_SVG.pm | 1 + fhem/FHEM/98_XmlList.pm | 1 + fhem/FHEM/98_autocreate.pm | 1 + fhem/FHEM/98_average.pm | 1 + fhem/FHEM/98_backup.pm | 1 + fhem/FHEM/98_cmdalias.pm | 1 + fhem/FHEM/98_dummy.pm | 1 + fhem/FHEM/98_structure.pm | 1 + fhem/FHEM/98_telnet.pm | 1 + fhem/FHEM/98_update.pm | 1 + fhem/FHEM/98_weblink.pm | 1 + fhem/contrib/commandref_join.pl | 54 ++++++++------ fhem/docs/commandref_frame.html | 24 ++----- fhem/docs/commandref_frame_DE.html | 111 ++--------------------------- 26 files changed, 63 insertions(+), 150 deletions(-) diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index de7a44501..1019b9e76 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -2889,6 +2889,7 @@ FW_widgetOverride($$) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/90_at.pm b/fhem/FHEM/90_at.pm index 76489bfa6..612dd6a32 100755 --- a/fhem/FHEM/90_at.pm +++ b/fhem/FHEM/90_at.pm @@ -371,6 +371,7 @@ EOF 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/91_eventTypes.pm b/fhem/FHEM/91_eventTypes.pm index 3a00bcebb..c1b975894 100755 --- a/fhem/FHEM/91_eventTypes.pm +++ b/fhem/FHEM/91_eventTypes.pm @@ -217,6 +217,7 @@ eventTypes_Get($@) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/91_notify.pm b/fhem/FHEM/91_notify.pm index 312f807cf..377ea2213 100755 --- a/fhem/FHEM/91_notify.pm +++ b/fhem/FHEM/91_notify.pm @@ -243,6 +243,7 @@ notify_fhemwebFn($$$$) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/91_sequence.pm b/fhem/FHEM/91_sequence.pm index 2a9a37dee..413aa73d0 100755 --- a/fhem/FHEM/91_sequence.pm +++ b/fhem/FHEM/91_sequence.pm @@ -130,6 +130,7 @@ sequence_Undef($$) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/91_watchdog.pm b/fhem/FHEM/91_watchdog.pm index 0842dc8e1..bf9cf70c8 100755 --- a/fhem/FHEM/91_watchdog.pm +++ b/fhem/FHEM/91_watchdog.pm @@ -196,6 +196,7 @@ watchdog_Attr(@) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/92_FileLog.pm b/fhem/FHEM/92_FileLog.pm index dbaccb422..18d24c87e 100755 --- a/fhem/FHEM/92_FileLog.pm +++ b/fhem/FHEM/92_FileLog.pm @@ -1050,6 +1050,7 @@ FileLog_regexpFn($$) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/93_FHEM2FHEM.pm b/fhem/FHEM/93_FHEM2FHEM.pm index 8f36f6441..9c2a90d25 100755 --- a/fhem/FHEM/93_FHEM2FHEM.pm +++ b/fhem/FHEM/93_FHEM2FHEM.pm @@ -327,6 +327,7 @@ FHEM2FHEM_Set($@) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/95_holiday.pm b/fhem/FHEM/95_holiday.pm index 1144d999c..71cfdbac7 100755 --- a/fhem/FHEM/95_holiday.pm +++ b/fhem/FHEM/95_holiday.pm @@ -267,6 +267,7 @@ western_easter($) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/96_allowed.pm b/fhem/FHEM/96_allowed.pm index f4fd091e3..07d90313f 100755 --- a/fhem/FHEM/96_allowed.pm +++ b/fhem/FHEM/96_allowed.pm @@ -203,6 +203,7 @@ allowed_Attr(@) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/98_CULflash.pm b/fhem/FHEM/98_CULflash.pm index 5ed29ab4b..8ce6946c7 100644 --- a/fhem/FHEM/98_CULflash.pm +++ b/fhem/FHEM/98_CULflash.pm @@ -96,6 +96,7 @@ CommandCULflash($$) 1; =pod +=item command =begin html diff --git a/fhem/FHEM/98_JsonList2.pm b/fhem/FHEM/98_JsonList2.pm index c9b1f9353..b9366aa8b 100644 --- a/fhem/FHEM/98_JsonList2.pm +++ b/fhem/FHEM/98_JsonList2.pm @@ -127,7 +127,7 @@ CommandJsonList2($$) 1; =pod - +=item command =begin html diff --git a/fhem/FHEM/98_SVG.pm b/fhem/FHEM/98_SVG.pm index 0e099df34..3e850a721 100755 --- a/fhem/FHEM/98_SVG.pm +++ b/fhem/FHEM/98_SVG.pm @@ -2274,6 +2274,7 @@ plotAsPng(@) ################## =pod +=item helper =begin html diff --git a/fhem/FHEM/98_XmlList.pm b/fhem/FHEM/98_XmlList.pm index 0d7babf94..91592c5e0 100644 --- a/fhem/FHEM/98_XmlList.pm +++ b/fhem/FHEM/98_XmlList.pm @@ -107,6 +107,7 @@ CommandXmlList($$) 1; =pod +=item command =begin html diff --git a/fhem/FHEM/98_autocreate.pm b/fhem/FHEM/98_autocreate.pm index fd6d9b889..c99fa439b 100644 --- a/fhem/FHEM/98_autocreate.pm +++ b/fhem/FHEM/98_autocreate.pm @@ -653,6 +653,7 @@ autocreate_Attr(@) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/98_average.pm b/fhem/FHEM/98_average.pm index 043164d31..037ce733a 100644 --- a/fhem/FHEM/98_average.pm +++ b/fhem/FHEM/98_average.pm @@ -190,6 +190,7 @@ average_Notify($$) =pod +=item helper =begin html diff --git a/fhem/FHEM/98_backup.pm b/fhem/FHEM/98_backup.pm index 53ade05d8..a679132f0 100644 --- a/fhem/FHEM/98_backup.pm +++ b/fhem/FHEM/98_backup.pm @@ -210,6 +210,7 @@ createArchiv($$) 1; =pod +=item command =begin html diff --git a/fhem/FHEM/98_cmdalias.pm b/fhem/FHEM/98_cmdalias.pm index 2710da77a..84d3034e0 100644 --- a/fhem/FHEM/98_cmdalias.pm +++ b/fhem/FHEM/98_cmdalias.pm @@ -96,6 +96,7 @@ CommandCmdAlias($$$) 1; =pod +=item command =begin html diff --git a/fhem/FHEM/98_dummy.pm b/fhem/FHEM/98_dummy.pm index 25d37dfbb..45472276d 100644 --- a/fhem/FHEM/98_dummy.pm +++ b/fhem/FHEM/98_dummy.pm @@ -53,6 +53,7 @@ dummy_Define($$) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/98_structure.pm b/fhem/FHEM/98_structure.pm index 8e1c602e9..cb247d364 100755 --- a/fhem/FHEM/98_structure.pm +++ b/fhem/FHEM/98_structure.pm @@ -509,6 +509,7 @@ structure_Attr($@) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/98_telnet.pm b/fhem/FHEM/98_telnet.pm index b5224cc7a..91cff0de7 100644 --- a/fhem/FHEM/98_telnet.pm +++ b/fhem/FHEM/98_telnet.pm @@ -364,6 +364,7 @@ telnet_ActivateInform($;$) 1; =pod +=item helper =begin html diff --git a/fhem/FHEM/98_update.pm b/fhem/FHEM/98_update.pm index d2b0aa822..5fe9318f1 100644 --- a/fhem/FHEM/98_update.pm +++ b/fhem/FHEM/98_update.pm @@ -609,6 +609,7 @@ upd_initRestoreDirs($) 1; =pod +=item command =begin html diff --git a/fhem/FHEM/98_weblink.pm b/fhem/FHEM/98_weblink.pm index 37fb7760d..3b5bedce7 100755 --- a/fhem/FHEM/98_weblink.pm +++ b/fhem/FHEM/98_weblink.pm @@ -137,6 +137,7 @@ weblink_FwFn($$$$) 1; =pod +=item helper =begin html diff --git a/fhem/contrib/commandref_join.pl b/fhem/contrib/commandref_join.pl index a8a05b60e..780aa2cfc 100755 --- a/fhem/contrib/commandref_join.pl +++ b/fhem/contrib/commandref_join.pl @@ -17,6 +17,7 @@ use constant TAGS => qw{ul li code b i u table tr td}; sub generateModuleCommandref($$;$); my %mods; +my %modIdx; my @modDir = ("FHEM"); my @lang = ("EN", "DE"); @@ -29,6 +30,12 @@ if(!$verify) { $l =~ s/.pm$//; $l =~ s/^[0-9][0-9]_//; $mods{$l} = "$modDir/$of"; + $modIdx{$l} = "device"; + open(MOD, "$modDir/$of") || die("Cant open $modDir/$l"); + while(my $cl = ) { + $modIdx{$l} = $1 if($cl =~ m/^=item\s*(helper|command|device)/); + } + close(MOD); } } $mods{configDB} = "configDB.pm" if(-f "configDB.pm"); @@ -42,7 +49,19 @@ if(!$verify) { exit; } - +sub +printList($) +{ + for my $i (sort { "\L$a" cmp "\L$b" } keys %modIdx) { + print OUT " $i  \n" + if($modIdx{$i} eq $_[0]); + } + while(my $l = ) { + next if($l =~ m/href=/); + print OUT $l; + last; + } +} foreach my $lang (@lang) { my $suffix = ($lang eq "EN" ? "" : "_$lang"); @@ -52,32 +71,23 @@ foreach my $lang (@lang) { open(IN, "$docIn") || die "Cant open $docIn: $!\n"; open(OUT, ">$docOut") || die "Cant open $docOut: $!\n"; - # First run: check what is a command and what is a helper module - my $status; - my %noindex; - while(my $l = ) { - last if($l =~ m/

Introduction/); - $noindex{$1} = 1 if($l =~ m/href="#(.*)"/); + if(!$suffix) { # First run: remember commands/helper module + my $modType; + while(my $l = ) { + $modType = "command" if($l =~ m/>Fhem commandsDevicesHelper modules/); + last if($l =~ m//); + } + seek(IN,0,0); } - seek(IN,0,0); # Second run: create the file - # Header - while(my $l = ) { - print OUT $l; - last if($l =~ m/#global/); - } - - # index for devices. - foreach my $mod (sort keys %mods) { - next if($noindex{$mod}); - print OUT " $mod  \n"; - } - - # Copy the middle part - while(my $l = ) { + while(my $l = ) { # Header last if($l =~ m/name="perl"/); print OUT $l; + printList($1) if($l =~ m//); } # Copy the doc part from the module diff --git a/fhem/docs/commandref_frame.html b/fhem/docs/commandref_frame.html index 16a0c5f55..5a13f42de 100644 --- a/fhem/docs/commandref_frame.html +++ b/fhem/docs/commandref_frame.html @@ -34,10 +34,9 @@
Fhem commands