Class | Hpricot::Elem |
In: |
lib/haml/html.rb
|
Parent: | Object |
@see Hpricot::Node
@see Hpricot::Node#to_haml
# File lib/haml/html.rb, line 151 151: def to_haml(tabs, options) 152: output = "#{tabulate(tabs)}" 153: if options[:rhtml] && name[0...5] == 'haml:' 154: return output + send("haml_tag_#{name[5..-1]}", CGI.unescapeHTML(self.inner_text)) 155: end 156: 157: output += "%#{name}" unless name == 'div' && 158: (static_id?(options) || static_classname?(options)) 159: 160: if attributes 161: if static_id?(options) 162: output += "##{attributes['id']}" 163: remove_attribute('id') 164: end 165: if static_classname?(options) 166: attributes['class'].split(' ').each { |c| output += ".#{c}" } 167: remove_attribute('class') 168: end 169: output += haml_attributes(options) if attributes.length > 0 170: end 171: 172: (self.children || []).inject(output + "\n") do |output, child| 173: output + child.to_haml(tabs + 1, options) 174: end 175: end