mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Add "Adding You Own Template Engine" section to README.
This commit is contained in:
parent
d7aa6a3b83
commit
9269686ad6
1 changed files with 17 additions and 0 deletions
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]
|
||||
|
||||
=== 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
|
||||
|
||||
Use the top-level <tt>helpers</tt> method to define helper methods for use in
|
||||
|
|
Loading…
Reference in a new issue