From 69b836a98ac5e05ebe471ecc101a7438861c3ffc Mon Sep 17 00:00:00 2001 From: Jerome Gravel-Niquet Date: Mon, 15 Feb 2016 12:09:33 -0500 Subject: [PATCH] use new Kilt 0.3 syntax, add mention in readme for clarity --- README.md | 2 +- src/kemal/helpers.cr | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 20e6e77..768d838 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ These results were achieved with ```wrk``` on a Macbook Pro Late 2013. (**2Ghz i - Middlewares - Built-in JSON support - Built-in static file serving -- Built-in view templating via ecr +- Built-in view templating via ECR (using [Kilt](https://github.com/jeromegn/kilt)) # Documentation diff --git a/src/kemal/helpers.cr b/src/kemal/helpers.cr index df67bd8..2c8c8b9 100644 --- a/src/kemal/helpers.cr +++ b/src/kemal/helpers.cr @@ -5,17 +5,16 @@ require "kilt" # get '/' do # render 'hello.ecr' # end -macro render(filename) - __view__ = String::Builder.new - Kilt.embed({{filename}}, "__view__") - __view__.to_s -end macro render(filename, layout) content = render {{filename}} render {{layout}} end +macro render(filename, *args) + Kilt.render({{filename}}, {{*args}}) +end + def add_handler(handler) Kemal.config.add_handler handler end