summaryrefslogtreecommitdiff
path: root/haml_lint/linter/documentation_links.rb
diff options
context:
space:
mode:
Diffstat (limited to 'haml_lint/linter/documentation_links.rb')
-rw-r--r--haml_lint/linter/documentation_links.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/haml_lint/linter/documentation_links.rb b/haml_lint/linter/documentation_links.rb
index 8c696b26b13..0cabae40c4b 100644
--- a/haml_lint/linter/documentation_links.rb
+++ b/haml_lint/linter/documentation_links.rb
@@ -68,7 +68,15 @@ module HamlLint
# Sometimes links are provided via data attributes in html tag
return node.parsed_attributes.syntax_tree if node.type == :tag
- node.parsed_script.syntax_tree
+ parse_script(node).syntax_tree
+ end
+
+ def parse_script(node)
+ # It's a workaround for cases for scripts ending with "do"
+ # For some reason they don't parse correctly
+ code = node.script.delete_suffix(' do')
+
+ HamlLint::ParsedRuby.new(HamlLint::RubyParser.new.parse(code))
end
def detect_path_to_file(link)