| Class | Hpricot::Elem |
| In: |
lib/haml/html.rb
|
| Parent: | Object |
@see Haml::HTML::Node#to_haml
# File lib/haml/html.rb, line 181
181: def to_haml(tabs, options)
182: output = "#{tabulate(tabs)}"
183: if options[:rhtml] && name[0...5] == 'haml:'
184: return output + send("haml_tag_#{name[5..-1]}", CGI.unescapeHTML(self.inner_text))
185: end
186:
187: output += "%#{name}" unless name == 'div' &&
188: (static_id?(options) || static_classname?(options))
189:
190: if attr_hash
191: if static_id?(options)
192: output += "##{attr_hash['id']}"
193: remove_attribute('id')
194: end
195: if static_classname?(options)
196: attr_hash['class'].split(' ').each { |c| output += ".#{c}" }
197: remove_attribute('class')
198: end
199: output += haml_attributes(options) if attr_hash.length > 0
200: end
201:
202: (self.children || []).inject(output + "\n") do |output, child|
203: output + child.to_haml(tabs + 1, options)
204: end
205: end