2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-15 10:09:12 +00:00

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
This commit is contained in:
rudolfkoenig 2017-02-20 10:16:40 +00:00
parent 872c0da83b
commit ac59825b12
2 changed files with 4 additions and 2 deletions

View File

@ -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/<a name="$mod"/) if(!$hasLink);
foreach $tag (TAGS) {
$tagcount{$tag} +=()= ($l =~ /<$tag>/gi);
$tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi);
$tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi) if($tagcount{$tag} > 0);
$llwct{$tag} = $line if(!$tagcount{$tag});
}
}

View File

@ -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}));
}
}