PATCH (Benjamin Birnbaum): HAML Layouts fixed
[sinatra.git] / vendor / haml / lib / haml.rb
blobfe37372ffd17ed122792b32484e89019624c16c2
1 module Sinatra
2   
3   module Haml # :nodoc:
4     
5     module EventContext
6       
7       # Renders raw haml in within the events context.
8       #
9       # This can be use to if you already have the template on hand and don't
10       # need a layout.  This is speedier than using haml
11       #
12       def render_haml(template, &block)
13         require 'haml'
14         body ::Haml::Engine.new(template).render(self, &block)
15       end
16       
17       # Renders Haml within an event.
18       # 
19       # Inline example:
20       # 
21       #   get '/foo' do
22       #     haml '== The time is #{Time.now}'
23       #   end
24       #
25       # Template example:
26       #
27       #   get '/foo' do
28       #     haml :foo  #=> reads and renders view/foo.haml
29       #   end
30       # 
31       # For options, see Sinatra::Renderer
32       #
33       # See also:  Sinatra::Renderer
34       def haml(template, options = {}, &layout)
35         render(template, :haml, options, &layout)
36       end
37     end
38     
39   end
40   
41 end