1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Pass haml-specs about tags

This commit is contained in:
Takashi Kokubun 2015-03-27 21:38:39 +09:00
parent 24a8a0fb7b
commit 2785fa048c

View file

@ -20,6 +20,26 @@ module Hamlit
[:static, exp]
end
end
def on_html_tag(name, attrs, content = nil)
if content.is_a?(Array) && content.first != :multi
return parse_oneline_tag(name, attrs, content)
end
super
end
private
def parse_oneline_tag(name, attrs, content)
name = name.to_s
closed = !content || (empty_exp?(content) && (@format == :xml || options[:autoclose].include?(name)))
result = [:multi, [:static, "<#{name}"], compile(attrs)]
result << [:static, (closed && @format != :html ? ' /' : '') + '>']
result << compile(content) if content
result << [:static, "</#{name}>"] if !closed
result
end
end
end
end