diff --git a/src/kemal/helpers/macros.cr b/src/kemal/helpers/macros.cr index 72f6a22..1949ecb 100644 --- a/src/kemal/helpers/macros.cr +++ b/src/kemal/helpers/macros.cr @@ -32,21 +32,21 @@ CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new # layout, inside the
tag, and each view can call content_for # setting the appropriate set of tags that should be added to the layout. macro content_for(key, file = __FILE__) - proc = ->() { + %proc = ->() { __kilt_io__ = MemoryIO.new {{ yield }} __kilt_io__.to_s } - CONTENT_FOR_BLOCKS[{{key}}] = Tuple.new {{file}}, proc + CONTENT_FOR_BLOCKS[{{key}}] = Tuple.new {{file}}, %proc nil end macro yield_content(key) if CONTENT_FOR_BLOCKS.has_key?({{key}}) __caller_filename__ = CONTENT_FOR_BLOCKS[{{key}}][0] - proc = CONTENT_FOR_BLOCKS[{{key}}][1] - proc.call if __content_filename__ == __caller_filename__ + %proc = CONTENT_FOR_BLOCKS[{{key}}][1] + %proc.call if __content_filename__ == __caller_filename__ end end