mirror of
https://gitea.invidious.io/iv-org/shard-kilt.git
synced 2024-08-15 00:43:15 +00:00
Add f/temel as template engine.
This commit is contained in:
parent
94ba25b593
commit
ead9441d6d
6 changed files with 36 additions and 1 deletions
|
@ -13,6 +13,7 @@ Simplify developers' lives by abstracting template rendering for multiple templa
|
|||
| ECR | .ecr | none (part of the stdlib) | |
|
||||
| Mustache | .mustache | [crustache](https://github.com/MakeNowJust/crustache) | [@MakeNowJust](https://github.com/MakeNowJust) |
|
||||
| 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) |
|
||||
|
||||
See also:
|
||||
[Registering your own template engine](#registering-your-own-template-engine).
|
||||
|
@ -25,7 +26,7 @@ Add this to your application's `shard.yml`:
|
|||
dependencies:
|
||||
kilt:
|
||||
github: jeromegn/kilt
|
||||
|
||||
|
||||
# Any other template languages Crystal shard
|
||||
```
|
||||
|
||||
|
@ -100,3 +101,4 @@ Please contribute your own "adapter" if you create a template language for Cryst
|
|||
- [jeromegn](https://github.com/jeromegn) Jerome Gravel-Niquet - creator, maintainer
|
||||
- [waterlink](https://github.com/waterlink) Oleksii Fedorov
|
||||
- [MakeNowJust](https://github.com/MakeNowJust) TSUYUSATO Kitsune
|
||||
- [f](https://github.com/f) Fatih Kadir Akın
|
||||
|
|
|
@ -11,3 +11,5 @@ development_dependencies:
|
|||
github: jeromegn/slang
|
||||
crustache:
|
||||
github: MakeNowJust/crustache
|
||||
temel:
|
||||
github: f/temel
|
||||
|
|
1
spec/fixtures/test.temel
vendored
Normal file
1
spec/fixtures/test.temel
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
span Process.pid
|
18
spec/kilt/temel_spec.cr
Normal file
18
spec/kilt/temel_spec.cr
Normal file
|
@ -0,0 +1,18 @@
|
|||
require "../spec_helper"
|
||||
require "../../src/kilt/temel"
|
||||
|
||||
class TemelView
|
||||
Kilt.file "spec/fixtures/test.temel"
|
||||
end
|
||||
|
||||
describe "kilt/temel" do
|
||||
|
||||
it "renders temel" do
|
||||
Kilt.render("spec/fixtures/test.temel").should eq("<span>#{Process.pid}</span>")
|
||||
end
|
||||
|
||||
it "works with classes" do
|
||||
TemelView.new.to_s.should eq("<span>#{Process.pid}</span>")
|
||||
end
|
||||
|
||||
end
|
3
src/kilt/helpers/temel_embedder.cr
Normal file
3
src/kilt/helpers/temel_embedder.cr
Normal file
|
@ -0,0 +1,3 @@
|
|||
require "temel"
|
||||
|
||||
puts File.read(ARGV[0]).to_s STDOUT
|
9
src/kilt/temel.cr
Normal file
9
src/kilt/temel.cr
Normal file
|
@ -0,0 +1,9 @@
|
|||
require "../kilt"
|
||||
require "temel"
|
||||
|
||||
macro embed_temel(filename, __kilt_io__)
|
||||
__kilt_io__ << {{ run("./helpers/temel_embedder.cr", filename) }}
|
||||
__kilt_io__
|
||||
end
|
||||
|
||||
Kilt.register_engine "temel", embed_temel
|
Loading…
Reference in a new issue