2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-27 20:34:52 +00:00

pre-commit: add better tagcount checking (Forum #105376)

git-svn-id: https://svn.fhem.de/fhem/trunk@20666 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-12-06 11:06:33 +00:00
parent 2a9258f489
commit 2b70a31cb1

View File

@ -129,7 +129,12 @@ foreach my $row (split("\n", $fList)) {
$hasLink = ($l =~ m/<a name="$modName"/) if(!$hasLink);
foreach $tag (TAGS) {
my $ot = ($tagcount{$tag} ? $tagcount{$tag} : 0);
$tagcount{$tag} +=()= ($l =~ /<$tag>/gi);
if($l =~ m/<$tag ([^>]+)>/i) {
my $attr = $1;
err $fName, "$lang line $line: $tag with attributes (apart ".
"from class) is not allowed\n" ;
}
$tagcount{$tag} +=()= ($l =~ /<$tag( [^>]+)?>/gi);
$tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi);
if($tagcount{$tag} < 0) {
err $fName, "$lang: negative tagcount for $tag, line $line";