Class: ThemeCheck::HtmlVisitor

Inherits:
Object
  • Object
show all
Includes:
RegexHelpers
Defined in:
lib/theme_check/html_visitor.rb

Constant Summary

Constants included from RegexHelpers

RegexHelpers::HTML_LIQUID_PLACEHOLDER, RegexHelpers::LIQUID_TAG, RegexHelpers::LIQUID_TAG_OR_VARIABLE, RegexHelpers::LIQUID_VARIABLE, RegexHelpers::START_OR_END_QUOTE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RegexHelpers

#matches

Constructor Details

#initialize(checks) ⇒ HtmlVisitor

Returns a new instance of HtmlVisitor.



10
11
12
# File 'lib/theme_check/html_visitor.rb', line 10

def initialize(checks)
  @checks = checks
end

Instance Attribute Details

#checksObject (readonly)

Returns the value of attribute checks.



8
9
10
# File 'lib/theme_check/html_visitor.rb', line 8

def checks
  @checks
end

Instance Method Details

#visit_liquid_file(liquid_file) ⇒ Object



14
15
16
17
18
19
# File 'lib/theme_check/html_visitor.rb', line 14

def visit_liquid_file(liquid_file)
  doc, placeholder_values = parse(liquid_file)
  visit(HtmlNode.new(doc, liquid_file, placeholder_values))
rescue ArgumentError => e
  call_checks(:on_parse_error, e, liquid_file)
end