diff --git a/.travis.yml b/.travis.yml
index ffc7b6a..fd4ce0f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1 +1,3 @@
language: crystal
+crystal:
+ - latest
\ No newline at end of file
diff --git a/README.md b/README.md
index 4327298..62d524f 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Kilt [](https://travis-ci.org/jeromegn/kilt) [](https://shards.rocks/github/jeromegn/kilt) [](https://shards.rocks/github/jeromegn/kilt)
+# Kilt [](https://travis-ci.org/jeromegn/kilt)
Generic templating interface for Crystal.
@@ -15,6 +15,9 @@ Simplify developers' lives by abstracting template rendering for multiple templa
| Slang | .slang | [slang](https://github.com/jeromegn/slang) | [@jeromegn](https://github.com/jeromegn) |
| Temel | .temel | [temel](https://github.com/f/temel) | [@f](https://github.com/f) |
| Crikey | .crikey | [crikey](https://github.com/domgetter/crikey) | [@domgetter](https://github.com/domgetter) |
+| Liquid | .liquid | [liquid](https://github.com/TechMagister/liquid.cr) | [@docelic](https://github.com/docelic) |
+| Jbuilder | .jbuilder | [jbuilder](https://github.com/shootingfly/jbuilder) | [@shootingfly](https://github.com/shootingfly) |
+| Water | .water | [water](https://github.com/shootingfly/water) | [@shootingfly](https://github.com/shootingfly) |
See also:
[Registering your own template engine](#registering-your-own-template-engine).
diff --git a/shard.yml b/shard.yml
index 277fa41..b7b6763 100644
--- a/shard.yml
+++ b/shard.yml
@@ -1,5 +1,5 @@
name: kilt
-version: 0.4.1
+version: 0.6.1
crystal: '< 2.0.0'
authors:
@@ -14,3 +14,9 @@ development_dependencies:
github: MakeNowJust/crustache
temel:
github: f/temel
+ liquid:
+ github: TechMagister/liquid.cr
+ jbuilder:
+ github: shootingfly/jbuilder
+ water:
+ github: shootingfly/water
diff --git a/spec/fixtures/test.jbuilder b/spec/fixtures/test.jbuilder
new file mode 100644
index 0000000..d8620f9
--- /dev/null
+++ b/spec/fixtures/test.jbuilder
@@ -0,0 +1 @@
+json.span Process.pid
\ No newline at end of file
diff --git a/spec/fixtures/test.liquid b/spec/fixtures/test.liquid
new file mode 100644
index 0000000..20464a7
--- /dev/null
+++ b/spec/fixtures/test.liquid
@@ -0,0 +1 @@
+{{ process.pid }}
diff --git a/spec/fixtures/test.water b/spec/fixtures/test.water
new file mode 100644
index 0000000..c0ff101
--- /dev/null
+++ b/spec/fixtures/test.water
@@ -0,0 +1 @@
+span Process.pid
\ No newline at end of file
diff --git a/spec/kilt/jbuilder_spec.cr b/spec/kilt/jbuilder_spec.cr
new file mode 100644
index 0000000..1798735
--- /dev/null
+++ b/spec/kilt/jbuilder_spec.cr
@@ -0,0 +1,18 @@
+require "../spec_helper"
+require "../../src/jbuilder"
+
+class JbuilderView
+ Kilt.file "spec/fixtures/test.jbuilder"
+end
+
+describe "kilt/jbuilder" do
+
+ it "renders jbuilder" do
+ Kilt.render("spec/fixtures/test.jbuilder").should eq("{\"span\":#{Process.pid}}")
+ end
+
+ it "works with class" do
+ JbuilderView.new.to_s.should eq("{\"span\":#{Process.pid}}")
+ end
+
+end
diff --git a/spec/kilt/liquid_spec.cr b/spec/kilt/liquid_spec.cr
new file mode 100644
index 0000000..f8c4a98
--- /dev/null
+++ b/spec/kilt/liquid_spec.cr
@@ -0,0 +1,31 @@
+require "../spec_helper"
+require "../../src/liquid"
+
+class LiquidView
+ @process = { "pid" => Process.pid }
+ Kilt.file "spec/fixtures/test.liquid"
+end
+
+class LiquidViewWithCustomContext
+ # Use of instance variable is not required in user code. It is used here to
+ # avoid name clash with 'context' variable existing within spec.
+ def initialize
+ @context = Liquid::Context.new
+ @context.set "process", { "pid" => Process.pid }
+ end
+ Kilt.file "spec/fixtures/test.liquid", "__kilt_io__", "@context"
+end
+
+it "renders liquid" do
+ ctx = Liquid::Context.new
+ ctx.set "process", { "pid" => Process.pid }
+ Kilt.render("spec/fixtures/test.liquid", ctx).should eq("#{Process.pid}\n")
+end
+
+it "works with classes" do
+ LiquidView.new.to_s.should eq("#{Process.pid}\n")
+end
+
+it "works with classes and custom context" do
+ LiquidViewWithCustomContext.new.to_s.should eq("#{Process.pid}\n")
+end
diff --git a/spec/kilt/water_spec.cr b/spec/kilt/water_spec.cr
new file mode 100644
index 0000000..274071d
--- /dev/null
+++ b/spec/kilt/water_spec.cr
@@ -0,0 +1,18 @@
+require "../spec_helper"
+require "../../src/water"
+
+class WaterView
+ Kilt.file "spec/fixtures/test.water"
+end
+
+describe "kilt/water" do
+
+ it "renders water" do
+ Kilt.render("spec/fixtures/test.water").should eq("#{Process.pid}")
+ end
+
+ it "works with class" do
+ WaterView.new.to_s.should eq("#{Process.pid}")
+ end
+
+end
diff --git a/src/jbuilder.cr b/src/jbuilder.cr
new file mode 100644
index 0000000..26bbbb2
--- /dev/null
+++ b/src/jbuilder.cr
@@ -0,0 +1,4 @@
+require "./kilt"
+require "jbuilder"
+
+Kilt.register_engine "jbuilder", Jbuilder.embed
diff --git a/src/kilt/version.cr b/src/kilt/version.cr
index 3d60e94..64c8001 100644
--- a/src/kilt/version.cr
+++ b/src/kilt/version.cr
@@ -1,3 +1,3 @@
module Kilt
- VERSION = "0.4.1"
+ VERSION = "0.6.1"
end
diff --git a/src/liquid.cr b/src/liquid.cr
new file mode 100644
index 0000000..68091d9
--- /dev/null
+++ b/src/liquid.cr
@@ -0,0 +1,4 @@
+require "./kilt"
+require "liquid"
+
+Kilt.register_engine "liquid", Liquid.embed
diff --git a/src/water.cr b/src/water.cr
new file mode 100644
index 0000000..383cca7
--- /dev/null
+++ b/src/water.cr
@@ -0,0 +1,4 @@
+require "./kilt"
+require "water"
+
+Kilt.register_engine "water", Water.embed