Class: Thymeleaf::Parser
- Inherits:
-
Struct
- Object
- Struct
- Thymeleaf::Parser
- Defined in:
- lib/thymeleaf/parser.rb
Instance Attribute Summary collapse
-
#template_markup ⇒ Object
Returns the value of attribute template_markup.
Instance Method Summary collapse
Instance Attribute Details
#template_markup ⇒ Object
Returns the value of attribute template_markup
6 7 8 |
# File 'lib/thymeleaf/parser.rb', line 6 def template_markup @template_markup end |
Instance Method Details
#call ⇒ Object
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 |