diff --git a/fhem/contrib/commandref_join.pl b/fhem/contrib/commandref_join.pl index 95f8b3c7a..b50febbde 100755 --- a/fhem/contrib/commandref_join.pl +++ b/fhem/contrib/commandref_join.pl @@ -120,6 +120,7 @@ sub generateModuleCommandref($$;$) my $tag; my $suffix = ($lang eq "EN" ? "" : "_$lang"); my %tagcount= (); + map { $tagcount{$_} = 0 } TAGS; my %llwct = (); # Last line with closed tag open(MOD, $mods{$mod}) || die("Cant open $mods{$mod}:$!\n"); my $skip = 1; @@ -146,7 +147,7 @@ sub generateModuleCommandref($$;$) $hasLink = ($l =~ m//gi); - $tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi); + $tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi) if($tagcount{$tag} > 0); $llwct{$tag} = $line if(!$tagcount{$tag}); } } diff --git a/fhem/contrib/pre-commit b/fhem/contrib/pre-commit index 1653f2c4f..94542f8b2 100755 --- a/fhem/contrib/pre-commit +++ b/fhem/contrib/pre-commit @@ -85,6 +85,7 @@ foreach my $row (split("\n", $fList)) { my $suffix = ($lang eq "EN" ? "" : "_$lang"); my $tag; my %tagcount= (); + map { $tagcount{$_} = 0 } TAGS; my %llwct = (); # Last line with closed tag open(MOD, "$svnlook $arg cat $repos $fName|") || die("Cant svnlook cat $fName:$!\n"); @@ -121,7 +122,7 @@ foreach my $row (split("\n", $fList)) { foreach $tag (TAGS) { my $ot = ($tagcount{$tag} ? $tagcount{$tag} : 0); $tagcount{$tag} +=()= ($l =~ /<$tag>/gi); - $tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi); + $tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi) if($tagcount{$tag} > 0); $llwct{$tag} = $line if(!$llwct{$tag} || ($ot && !$tagcount{$tag})); } }