Add f/temel as template engine.

This commit is contained in:
Fatih Kadir Akın 2016-02-16 10:55:13 +02:00
parent 94ba25b593
commit ead9441d6d
6 changed files with 36 additions and 1 deletions

View file

@ -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).
@ -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

View file

@ -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
View file

@ -0,0 +1 @@
span Process.pid

18
spec/kilt/temel_spec.cr Normal file
View 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

View file

@ -0,0 +1,3 @@
require "temel"
puts File.read(ARGV[0]).to_s STDOUT

9
src/kilt/temel.cr Normal file
View 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