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

Compile attributes

This commit is contained in:
Takashi Kokubun 2015-10-11 11:58:14 +09:00
parent b235f9a9e7
commit 634bcad7d9

View file

@ -9,7 +9,7 @@ module Hamlit
when :root
compile_children(node)
when :tag
[:html, :tag, node.value[:name], [:html, :attrs], [:multi]]
compile_tag(node)
else
[:static, "\n"]
end
@ -22,5 +22,13 @@ module Hamlit
temple = node.children.map { |n| compile(n) }
[:multi, *temple]
end
def compile_tag(node)
attrs = [:html, :attrs]
node.value[:attributes].each do |name, value|
attrs << [:html, :attr, name, [:static, value]]
end
[:html, :tag, node.value[:name], attrs, [:multi]]
end
end
end