mirror of
https://gitea.invidious.io/iv-org/shard-kilt.git
synced 2024-08-15 00:43:15 +00:00
Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
|
772ad9eb47 |
13 changed files with 3 additions and 96 deletions
|
@ -1,3 +1 @@
|
||||||
language: crystal
|
language: crystal
|
||||||
crystal:
|
|
||||||
- latest
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Kilt [](https://travis-ci.org/jeromegn/kilt)
|
# Kilt [](https://travis-ci.org/jeromegn/kilt) [](https://shards.rocks/github/jeromegn/kilt) [](https://shards.rocks/github/jeromegn/kilt)
|
||||||
|
|
||||||
Generic templating interface for Crystal.
|
Generic templating interface for Crystal.
|
||||||
|
|
||||||
|
@ -15,9 +15,6 @@ Simplify developers' lives by abstracting template rendering for multiple templa
|
||||||
| Slang | .slang | [slang](https://github.com/jeromegn/slang) | [@jeromegn](https://github.com/jeromegn) |
|
| 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) |
|
| 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) |
|
| 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:
|
See also:
|
||||||
[Registering your own template engine](#registering-your-own-template-engine).
|
[Registering your own template engine](#registering-your-own-template-engine).
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: kilt
|
name: kilt
|
||||||
version: 0.6.1
|
version: 0.4.1
|
||||||
crystal: '< 2.0.0'
|
crystal: '< 2.0.0'
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
|
@ -14,9 +14,3 @@ development_dependencies:
|
||||||
github: MakeNowJust/crustache
|
github: MakeNowJust/crustache
|
||||||
temel:
|
temel:
|
||||||
github: f/temel
|
github: f/temel
|
||||||
liquid:
|
|
||||||
github: TechMagister/liquid.cr
|
|
||||||
jbuilder:
|
|
||||||
github: shootingfly/jbuilder
|
|
||||||
water:
|
|
||||||
github: shootingfly/water
|
|
||||||
|
|
1
spec/fixtures/test.jbuilder
vendored
1
spec/fixtures/test.jbuilder
vendored
|
@ -1 +0,0 @@
|
||||||
json.span Process.pid
|
|
1
spec/fixtures/test.liquid
vendored
1
spec/fixtures/test.liquid
vendored
|
@ -1 +0,0 @@
|
||||||
<span>{{ process.pid }}</span>
|
|
1
spec/fixtures/test.water
vendored
1
spec/fixtures/test.water
vendored
|
@ -1 +0,0 @@
|
||||||
span Process.pid
|
|
|
@ -1,18 +0,0 @@
|
||||||
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
|
|
|
@ -1,31 +0,0 @@
|
||||||
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("<span>#{Process.pid}</span>\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "works with classes" do
|
|
||||||
LiquidView.new.to_s.should eq("<span>#{Process.pid}</span>\n")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "works with classes and custom context" do
|
|
||||||
LiquidViewWithCustomContext.new.to_s.should eq("<span>#{Process.pid}</span>\n")
|
|
||||||
end
|
|
|
@ -1,18 +0,0 @@
|
||||||
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("<span>#{Process.pid}</span>")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "works with class" do
|
|
||||||
WaterView.new.to_s.should eq("<span>#{Process.pid}</span>")
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
require "./kilt"
|
|
||||||
require "jbuilder"
|
|
||||||
|
|
||||||
Kilt.register_engine "jbuilder", Jbuilder.embed
|
|
|
@ -1,3 +1,3 @@
|
||||||
module Kilt
|
module Kilt
|
||||||
VERSION = "0.6.1"
|
VERSION = "0.4.1"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
require "./kilt"
|
|
||||||
require "liquid"
|
|
||||||
|
|
||||||
Kilt.register_engine "liquid", Liquid.embed
|
|
|
@ -1,4 +0,0 @@
|
||||||
require "./kilt"
|
|
||||||
require "water"
|
|
||||||
|
|
||||||
Kilt.register_engine "water", Water.embed
|
|
Loading…
Add table
Add a link
Reference in a new issue