Add "Adding You Own Template Engine" section to README.
This commit is contained in:
parent
d7aa6a3b83
commit
9269686ad6
17
README.rdoc
17
README.rdoc
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue