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::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

#href_to_file_size, #matches

Constructor Details

#initialize(checks) ⇒ HtmlVisitor

Returns a new instance of HtmlVisitor.



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

def initialize(checks)
  @checks = checks
  @placeholder_values = []
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_template(template) ⇒ Object



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

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