Class: Thymeleaf::Parser

Inherits:
Struct
  • Object
show all
Defined in:
lib/thymeleaf/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#template_markupObject

Returns the value of attribute template_markup

Returns:

  • (Object)

    the current value of template_markup



6
7
8
# File 'lib/thymeleaf/parser.rb', line 6

def template_markup
  @template_markup
end

Instance Method Details

#callObject



7
8
9
10
11
12
13
# File 'lib/thymeleaf/parser.rb', line 7

def call
  if /^\s*(?:\s*<!--[^>]*-->)*\s*<(?:html|!doctype)/i.match(template_markup)
    Nokogiri::HTML(template_markup, Thymeleaf.configuration.parser.encoding)
  else
    Nokogiri::HTML::fragment(template_markup, Thymeleaf.configuration.parser.encoding)
  end
end