summaryrefslogtreecommitdiff
path: root/haml_lint/linter/no_plain_nodes.rb
diff options
context:
space:
mode:
Diffstat (limited to 'haml_lint/linter/no_plain_nodes.rb')
-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