From 0ab0ecb7c620aa0379fe978ce8b66e057cd02f37 Mon Sep 17 00:00:00 2001 From: Serdar Dogruyol <990485+sdogruyol@users.noreply.github.com> Date: Wed, 8 Sep 2021 16:21:25 +0300 Subject: [PATCH] Remove all code references to Kilt --- src/kemal/helpers/macros.cr | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/kemal/helpers/macros.cr b/src/kemal/helpers/macros.cr index 59735c1..41c8793 100644 --- a/src/kemal/helpers/macros.cr +++ b/src/kemal/helpers/macros.cr @@ -1,5 +1,3 @@ -require "kilt" - CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new # `content_for` is a set of helpers that allows you to capture @@ -37,9 +35,9 @@ CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new # setting the appropriate set of tags that should be added to the layout. macro content_for(key, file = __FILE__) %proc = ->() { - __kilt_io__ = IO::Memory.new + __view_io__ = IO::Memory.new {{ yield }} - __kilt_io__.to_s + __view_io__.to_s } CONTENT_FOR_BLOCKS[{{key}}] = Tuple.new {{file}}, %proc @@ -60,17 +58,17 @@ end # ``` # render "src/views/index.ecr", "src/views/layout.ecr" # ``` -@[Deprecated("Use `ECR#render` instead")] macro render(filename, layout) __content_filename__ = {{filename}} - content = render {{filename}} - render {{layout}} + io = IO::Memory.new + content = ECR.embed {{filename}}, io + ECR.embed {{layout}}, io + io.to_s end # Render view with the given filename. -@[Deprecated("Use `ECR#render` instead")] macro render(filename) - Kilt.render({{filename}}) + ECR.render({{filename}}) end # Halt execution with the current context.