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:
parent
24a8a0fb7b
commit
2785fa048c
1 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue