From f8e0a34a4448e58fdfe46bfe7631bb7cb316b7a6 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Mon, 20 Sep 2010 12:09:33 +0200 Subject: [PATCH] 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. --- lib/sinatra/base.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/sinatra/base.rb b/lib/sinatra/base.rb index d06c0c32..d87aaf46 100644 --- a/lib/sinatra/base.rb +++ b/lib/sinatra/base.rb @@ -301,12 +301,10 @@ module Sinatra 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 @@ -368,6 +366,7 @@ module Sinatra 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 || {}