From bfd7ffc93561b56ad2fcfa3768c509787aca046d Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Mon, 3 Jun 2019 20:25:25 +0000 Subject: [PATCH] commandref_join.pl: add =end check (Forum #101114) git-svn-id: https://svn.fhem.de/fhem/trunk@19539 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/commandref_join.pl | 6 ++++++ fhem/contrib/pre-commit | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/fhem/contrib/commandref_join.pl b/fhem/contrib/commandref_join.pl index 4bc9ab1de..b7404cb3c 100755 --- a/fhem/contrib/commandref_join.pl +++ b/fhem/contrib/commandref_join.pl @@ -154,6 +154,7 @@ generateModuleCommandref($$;$$) my $docCount = 0; my $hasLink = 0; my $dosMode = 0; + my $nrEnd = 0; while(my $l = <$modFh>) { $line++; @@ -163,9 +164,11 @@ generateModuleCommandref($$;$$) print "*** $lang $mod: nonempty line after =begin html ignored\n" if($l =~ m/^...*$/); $skip = 0; $line++; + $nrEnd++; } elsif($l =~ m/^=end html$suffix$/) { $skip = 1; + $nrEnd--; print $fh "

" if($fh); } elsif(!$skip) { @@ -222,4 +225,7 @@ EOF "($tagcount{$tag}, last line ok: $llwct{$tag})\n") if($tagcount{$tag} && !$noWarnings); } + + print "*** $lang $fPath: =end html$suffix: ".($nrEnd>0 ? "missing":"there are too many")."\n" + if($nrEnd); } diff --git a/fhem/contrib/pre-commit b/fhem/contrib/pre-commit index 2f7ed4346..ef1fc5077 100755 --- a/fhem/contrib/pre-commit +++ b/fhem/contrib/pre-commit @@ -99,6 +99,7 @@ foreach my $row (split("\n", $fList)) { my $docCount = 0; my $hasLink = 0; my $hasSummary = 0; + my $nrEnd = 0; while(my $l = ) { $line++; @@ -117,9 +118,11 @@ foreach my $row (split("\n", $fList)) { err($fName, "$lang: nonempty line after =begin html.") if($l =~ m/^...*$/); $skip = 0; $line++; + $nrEnd++; } elsif($l =~ m/^=end html$suffix$/) { $skip = 1; + $nrEnd--; } elsif(!$skip) { $docCount++; @@ -144,6 +147,8 @@ foreach my $row (split("\n", $fList)) { if(!$suffix && $docCount && !$hasLink); err $fName, "$lang: No summary description found" if(!$suffix && $docCount && !$hasSummary); + err $fName, "$lang: =end html$suffix: ".($nrEnd>0 ? "missing":"there are too many")."\n" + if($nrEnd); foreach $tag (TAGS) { err $fName, "$lang: Unbalanced $tag ($tagcount{$tag}, last line ok: $llwct{$tag})"