mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-28 02:44:53 +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:
parent
2a9258f489
commit
2b70a31cb1
@ -129,7 +129,12 @@ foreach my $row (split("\n", $fList)) {
|
|||||||
$hasLink = ($l =~ m/<a name="$modName"/) if(!$hasLink);
|
$hasLink = ($l =~ m/<a name="$modName"/) if(!$hasLink);
|
||||||
foreach $tag (TAGS) {
|
foreach $tag (TAGS) {
|
||||||
my $ot = ($tagcount{$tag} ? $tagcount{$tag} : 0);
|
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);
|
$tagcount{$tag} -=()= ($l =~ /<\/$tag>/gi);
|
||||||
if($tagcount{$tag} < 0) {
|
if($tagcount{$tag} < 0) {
|
||||||
err $fName, "$lang: negative tagcount for $tag, line $line";
|
err $fName, "$lang: negative tagcount for $tag, line $line";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user