Module | Haml::HTML::Node
In: | lib/haml/html.rb

A module containing utility methods that every Hpricot node should have.

### Methods

to_haml

### 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)

Returns the Haml representation of the given node.

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

[Source]

        # File lib/haml/html.rb, line 22
    22:       def to_haml(tabs, options)
    23:         return "" if converted_to_haml || to_s.strip.empty?
    24:         text = uninterp(self.to_s)
    25:         node = next_node
    26:         while node.is_a?(::Hpricot::Elem) && node.name == "haml:loud"
    27:           node.converted_to_haml = true
    28:           text << '#{' <<
    29:             CGI.unescapeHTML(node.inner_text).gsub(/\n\s*/, ' ').strip << '}'
    30:
    31:           if node.next_node.is_a?(::Hpricot::Text)
    32:             node = node.next_node
    33:             text << uninterp(node.to_s)
    34:             node.converted_to_haml = true
    35:           end
    36:
    37:           node = node.next_node
    38:         end
    39:         return parse_text_with_interpolation(text, tabs)
    40:       end

[Validate]