summaryrefslogtreecommitdiff
path: root/haml_lint
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-20 14:34:42 +0000
commit9f46488805e86b1bc341ea1620b866016c2ce5ed (patch)
treef9748c7e287041e37d6da49e0a29c9511dc34768 /haml_lint
parentdfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff)
downloadgitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'haml_lint')
-rw-r--r--haml_lint/linter/no_plain_nodes.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/haml_lint/linter/no_plain_nodes.rb b/haml_lint/linter/no_plain_nodes.rb
index c39f61fa80d..d0d9c165a19 100644
--- a/haml_lint/linter/no_plain_nodes.rb
+++ b/haml_lint/linter/no_plain_nodes.rb
@@ -51,6 +51,7 @@ module HamlLint
attributes = node.attributes_source.map(&:last)
attributes.each { |attribute| text = text.gsub(attribute, '') }
+ text = strip_html_entities(text)
text.strip
end
@@ -77,7 +78,12 @@ module HamlLint
def text_node?(node)
return false unless plain_node?(node)
- !node.text.empty?
+ text = strip_html_entities(node.text)
+ !text.empty?
+ end
+
+ def strip_html_entities(text)
+ text.gsub(/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});/i, "")
end
end
end