In Files

Methods

Hpricot::Node

@see Hpricot

Attributes

converted_to_haml[RW]

Whether this node has already been converted to Haml. Only used for text nodes and elements.

@return [Boolean]

Public Instance Methods

to_haml(tabs, options) click to toggle source

Returns the Haml representation of the given node.

@param tabs [Fixnum] The indentation level of the resulting Haml. @option options (see Haml::HTML#initialize)

# File lib/haml/html.rb, line 24
def to_haml(tabs, options)
  return "" if converted_to_haml || to_s.strip.empty?
  text = uninterp(self.to_s)
  node = next_node
  while node.is_a?(::Hpricot::Elem) && node.name == "haml:loud"
    node.converted_to_haml = true
    text << '#{' <<
      CGI.unescapeHTML(node.inner_text).gsub(/\n\s*/, ' ').strip << '}'

    if node.next_node.is_a?(::Hpricot::Text)
      node = node.next_node
      text << uninterp(node.to_s)
      node.converted_to_haml = true
    end

    node = node.next_node
  end
  return parse_text_with_interpolation(text, tabs)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.