mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Compile attributes
This commit is contained in:
parent
b235f9a9e7
commit
634bcad7d9
1 changed files with 9 additions and 1 deletions
|
@ -9,7 +9,7 @@ module Hamlit
|
||||||
when :root
|
when :root
|
||||||
compile_children(node)
|
compile_children(node)
|
||||||
when :tag
|
when :tag
|
||||||
[:html, :tag, node.value[:name], [:html, :attrs], [:multi]]
|
compile_tag(node)
|
||||||
else
|
else
|
||||||
[:static, "\n"]
|
[:static, "\n"]
|
||||||
end
|
end
|
||||||
|
@ -22,5 +22,13 @@ module Hamlit
|
||||||
temple = node.children.map { |n| compile(n) }
|
temple = node.children.map { |n| compile(n) }
|
||||||
[:multi, *temple]
|
[:multi, *temple]
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue