mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Refactor using :block
This commit is contained in:
parent
8714c57656
commit
b470d3d257
2 changed files with 8 additions and 10 deletions
|
@ -73,10 +73,9 @@ module Hamlit
|
|||
]
|
||||
else
|
||||
[:multi,
|
||||
[:code, "#{var} = #{node.value[:text]}"],
|
||||
[:newline],
|
||||
yield(node),
|
||||
[:code, 'end'.freeze],
|
||||
[:block, "#{var} = #{node.value[:text]}",
|
||||
[:multi, [:newline], yield(node)],
|
||||
],
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,12 +12,11 @@ module Hamlit
|
|||
private
|
||||
|
||||
def compile_with_children(node, &block)
|
||||
temple = [:multi]
|
||||
temple << [:code, node.value[:text]]
|
||||
temple << [:newline]
|
||||
temple << yield(node)
|
||||
temple << [:code, 'end']
|
||||
temple
|
||||
[:multi,
|
||||
[:block, node.value[:text],
|
||||
[:multi, [:newline], yield(node)],
|
||||
],
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue