1
0
Fork 0
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:
Takashi Kokubun 2016-01-12 22:43:27 +09:00
parent 8714c57656
commit b470d3d257
2 changed files with 8 additions and 10 deletions

View file

@ -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

View file

@ -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