Skip to content

Commit

Permalink
Set outvar for any template engine (so it is usable from liquid, text…
Browse files Browse the repository at this point in the history
…ile and markdown). Also, only set it if not present, allowing to override it.
  • Loading branch information
rkh committed Sep 20, 2010
1 parent 1cf1c76 commit f8e0a34
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/sinatra/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,10 @@ module Templates
include Tilt::CompileSite

def erb(template, options={}, locals={})
options[:outvar] = '@_out_buf'
render :erb, template, options, locals
end

def erubis(template, options={}, locals={})
options[:outvar] = '@_out_buf'
render :erubis, template, options, locals
end

Expand Down Expand Up @@ -368,6 +366,7 @@ def coffee(template, options={}, locals={})
def render(engine, data, options={}, locals={}, &block)
# merge app-level options
options = settings.send(engine).merge(options) if settings.respond_to?(engine)
options[:outvar] ||= '@_out_buf'

# extract generic options
locals = options.delete(:locals) || locals || {}
Expand Down

0 comments on commit f8e0a34

Please sign in to comment.