class Haml::HTML

def initialize(template, options = {})

Options Hash: (**options)
  • :xhtml (Boolean) -- Whether or not to parse
  • :rhtml (Boolean) -- Whether or not to parse

Parameters:
  • template (String, Hpricot::Node) -- The HTML template to convert
def initialize(template, options = {})
  @options = options
  if template.is_a? Hpricot::Node
    @template = template
  else
    if template.is_a? IO
      template = template.read
    end
    if @options[:rhtml]
      match_to_html(template, /<%=(.*?)-?%>/m, 'loud')
      match_to_html(template, /<%-?(.*?)-?%>/m,  'silent')
    end
    method = @options[:xhtml] ? Hpricot.method(:XML) : method(:Hpricot)
    @template = method.call(template.gsub('&', '&amp;'))
  end
end