131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# File 'lib/gems/haml-2.0.4/lib/haml/html.rb', line 131
def to_haml(tabs = 0)
output = "#{tabulate(tabs)}"
if HTML.options[:rhtml] && name[0...5] == 'haml:'
return output + HTML.send("haml_tag_#{name[5..-1]}", CGI.unescapeHTML(self.inner_text))
end
output += "%#{name}" unless name == 'div' && (static_id? || static_classname?)
if attributes
if static_id?
output += "##{attributes['id']}"
remove_attribute('id')
end
if static_classname?
attributes['class'].split(' ').each { |c| output += ".#{c}" }
remove_attribute('class')
end
output += haml_attributes if attributes.length > 0
end
output += "/" if children.length == 0
output += "\n"
self.children.each do |child|
output += child.to_haml(tabs + 1)
end
output
end
|