Remove all code references to Kilt

This commit is contained in:
Serdar Dogruyol 2021-09-08 16:21:25 +03:00 committed by Serdar Dogruyol - Sedo セド
parent a251ede5bd
commit 0ab0ecb7c6
1 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,3 @@
require "kilt"
CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new CONTENT_FOR_BLOCKS = Hash(String, Tuple(String, Proc(String))).new
# `content_for` is a set of helpers that allows you to capture # `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. # setting the appropriate set of tags that should be added to the layout.
macro content_for(key, file = __FILE__) macro content_for(key, file = __FILE__)
%proc = ->() { %proc = ->() {
__kilt_io__ = IO::Memory.new __view_io__ = IO::Memory.new
{{ yield }} {{ yield }}
__kilt_io__.to_s __view_io__.to_s
} }
CONTENT_FOR_BLOCKS[{{key}}] = Tuple.new {{file}}, %proc CONTENT_FOR_BLOCKS[{{key}}] = Tuple.new {{file}}, %proc
@ -60,17 +58,17 @@ end
# ``` # ```
# render "src/views/index.ecr", "src/views/layout.ecr" # render "src/views/index.ecr", "src/views/layout.ecr"
# ``` # ```
@[Deprecated("Use `ECR#render` instead")]
macro render(filename, layout) macro render(filename, layout)
__content_filename__ = {{filename}} __content_filename__ = {{filename}}
content = render {{filename}} io = IO::Memory.new
render {{layout}} content = ECR.embed {{filename}}, io
ECR.embed {{layout}}, io
io.to_s
end end
# Render view with the given filename. # Render view with the given filename.
@[Deprecated("Use `ECR#render` instead")]
macro render(filename) macro render(filename)
Kilt.render({{filename}}) ECR.render({{filename}})
end end
# Halt execution with the current context. # Halt execution with the current context.