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
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue