Explain how to use :layout_engine in README.

This commit is contained in:
Konstantin Haase 2011-01-11 10:30:46 +01:00
parent de11b441bf
commit a0f47170d5
1 changed files with 66 additions and 0 deletions

View File

@ -362,6 +362,28 @@ Note that you may also call the +markdown+ method from within other templates:
%h1 Hello From Haml!
%p= markdown(:greetings)
Since you cannot call Ruby from Markdown, you cannot use layouts written in
Markdown. However, it is possible to use another rendering engine for the
template than for the layout by passing the `:layout_engine` option:
get '/' do
markdown :index, :layout_engine => :erb
end
This will render <tt>./views/index.md</tt> with <tt>./views/layout.erb</tt> as
layout.
Remember that you can set such rendering options globally:
set :markdown, :layout_engine => :haml, :layout => :post
get '/' do
markdown :index
end
This will render <tt>./views/index.md</tt> (and any other Markdown template)
with <tt>./views/post.haml</tt> as layout.
It is also possible to parse Markdown with BlueCloth rather than RDiscount:
require 'bluecloth'
@ -399,6 +421,28 @@ Note that you may also call the +textile+ method from within other templates:
%h1 Hello From Haml!
%p= textile(:greetings)
Since you cannot call Ruby from Textile, you cannot use layouts written in
Textile. However, it is possible to use another rendering engine for the
template than for the layout by passing the `:layout_engine` option:
get '/' do
textile :index, :layout_engine => :erb
end
This will render <tt>./views/index.textile</tt> with
<tt>./views/layout.erb</tt> as layout.
Remember that you can set such rendering options globally:
set :textile, :layout_engine => :haml, :layout => :post
get '/' do
textile :index
end
This will render <tt>./views/index.textile</tt> (and any other Textile
template) with <tt>./views/post.haml</tt> as layout.
=== RDoc Templates
The <tt>rdoc</tt> gem/library is required to render RDoc templates:
@ -422,6 +466,28 @@ Note that you may also call the +rdoc+ method from within other templates:
%h1 Hello From Haml!
%p= rdoc(:greetings)
Since you cannot call Ruby from RDoc, you cannot use layouts written in
RDoc. However, it is possible to use another rendering engine for the
template than for the layout by passing the `:layout_engine` option:
get '/' do
rdoc :index, :layout_engine => :erb
end
This will render <tt>./views/index.rdoc</tt> with <tt>./views/layout.erb</tt> as
layout.
Remember that you can set such rendering options globally:
set :rdoc, :layout_engine => :haml, :layout => :post
get '/' do
rdoc :index
end
This will render <tt>./views/index.rdoc</tt> (and any other RDoc template)
with <tt>./views/post.haml</tt> as layout.
=== Radius Templates
The <tt>radius</tt> gem/library is required to render Radius templates: