1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Set outvar for any template engine (so it is usable from liquid, textile and markdown). Also, only set it if not present, allowing to override it.

This commit is contained in:
Konstantin Haase 2010-09-20 12:09:33 +02:00
parent 1cf1c76c89
commit f8e0a34a44

View file

@ -301,12 +301,10 @@ module Sinatra
include Tilt::CompileSite include Tilt::CompileSite
def erb(template, options={}, locals={}) def erb(template, options={}, locals={})
options[:outvar] = '@_out_buf'
render :erb, template, options, locals render :erb, template, options, locals
end end
def erubis(template, options={}, locals={}) def erubis(template, options={}, locals={})
options[:outvar] = '@_out_buf'
render :erubis, template, options, locals render :erubis, template, options, locals
end end
@ -368,6 +366,7 @@ module Sinatra
def render(engine, data, options={}, locals={}, &block) def render(engine, data, options={}, locals={}, &block)
# merge app-level options # merge app-level options
options = settings.send(engine).merge(options) if settings.respond_to?(engine) options = settings.send(engine).merge(options) if settings.respond_to?(engine)
options[:outvar] ||= '@_out_buf'
# extract generic options # extract generic options
locals = options.delete(:locals) || locals || {} locals = options.delete(:locals) || locals || {}