Fix support for sinatra 1.2 custom layout engines

This commit is contained in:
Thomas Reynolds 2011-04-26 11:49:48 -07:00
parent 16ffd59ef9
commit e9960ea594

View file

@ -147,7 +147,10 @@ module Middleman
settings.layout(options[:layout]) if !options[:layout].nil? settings.layout(options[:layout]) if !options[:layout].nil?
layout = settings.fetch_layout_path.to_sym layout = settings.fetch_layout_path.to_sym
layout = false if options[:layout] == false or path =~ /\.(css|js)$/ layout = false if options[:layout] == false or path =~ /\.(css|js)$/
result = render(path, :layout => layout, :layout_engine => options[:layout_engine])
render_options = { :layout => layout }
render_options[:layout_engine] = options[:layout_engine] if options.has_key? :layout_engine
result = render(path, render_options)
settings.layout(old_layout) settings.layout(old_layout)
if result if result