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