class Haml::HTML

def initialize(template, options = {})

Options Hash: (**options)
  • :xhtml (Boolean) -- Whether or not to parse
  • :erb (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
    template = Haml::Util.check_encoding(template) {|msg, line| raise Haml::Error.new(msg, line)}
    if @options[:erb]
      require 'haml/html/erb'
      template = ERB.compile(template)
    end
    method = @options[:xhtml] ? Hpricot.method(:XML) : method(:Hpricot)
    @template = method.call(template.gsub('&', '&'))
  end
end

def render

containing the Haml template.
Processes the document and returns the result as a string
def render
  @template.to_haml(0, @options)
end