From ac59825b122e43eaa8457f3d5c03276e609c42eb Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Mon, 20 Feb 2017 10:16:40 +0000 Subject: [PATCH] pre-commit + commandref_join.pl: better ul count (dont allow to go negative). Forum #67480 git-svn-id: https://svn.fhem.de/fhem/trunk@13466 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/commandref_join.pl | 3 ++- fhem/contrib/pre-commit | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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})); } }