Class: Nokogiri::XML::Node
- Inherits:
-
Object
- Object
- Nokogiri::XML::Node
- Defined in:
- lib/html2haml/html.rb
Overview
Instance Attribute Summary collapse
-
#converted_to_haml ⇒ Boolean
Whether this node has already been converted to Haml.
Instance Method Summary collapse
-
#to_haml(tabs, options) ⇒ Object
Returns the Haml representation of the given node.
Instance Attribute Details
#converted_to_haml ⇒ Boolean
Whether this node has already been converted to Haml. Only used for text nodes and elements.
17 18 19 |
# File 'lib/html2haml/html.rb', line 17 def converted_to_haml @converted_to_haml end |
Instance Method Details
#to_haml(tabs, options) ⇒ Object
Returns the Haml representation of the given node.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/html2haml/html.rb', line 23 def to_haml(tabs, ) return "" if converted_to_haml || to_s.strip.empty? text = uninterp(self.to_s) #ending in a newline stops the inline nodes if text.end_with?("\n") parse_text_with_interpolation(text, tabs) else text << process_inline_nodes(next_sibling) parse_text_with_interpolation(text, tabs) end end |