Add "Adding You Own Template Engine" section to README.

This commit is contained in:
Konstantin Haase 2011-01-11 11:02:29 +01:00
parent d7aa6a3b83
commit 9269686ad6
1 changed files with 17 additions and 0 deletions

View File

@ -643,6 +643,23 @@ To associate a file extension with a template engine, use
Tilt.register :tt, Tilt[:textile] Tilt.register :tt, Tilt[:textile]
=== Adding You Own Template Engine
First, register your engine with Tilt, then create a rendering method:
Tilt.register :myat, MyAwesomeTemplateEngine
helpers do
def myat(*args) render(:myat, *args) end
end
get '/' do
myat :index
end
Renders <tt>./views/index.myat</tt>. See https://github.com/rtomayko/tilt to
learn more about Tilt.
== Helpers == Helpers
Use the top-level <tt>helpers</tt> method to define helper methods for use in Use the top-level <tt>helpers</tt> method to define helper methods for use in