module Roda::RodaPlugins::Render

def self.configure(app, opts=OPTS)

Setup default rendering options. See Render for details.
def self.configure(app, opts=OPTS)
  if app.opts[:render]
    app.opts[:render] = app.opts[:render].merge(opts)
  else
    app.opts[:render] = opts.dup
  end
  if opts[:opts] && !opts[:template_opts]
    RodaPlugins.deprecate("The render plugin :opts option is deprecated and will be removed in Roda 2.  Switch to using the :template_opts option")
    app.opts[:render][:template_opts] = opts[:opts]
  end
  opts = app.opts[:render]
  opts[:engine] ||= "erb"
  opts[:ext] = nil unless opts.has_key?(:ext)
  opts[:views] ||= File.expand_path("views", Dir.pwd)
  opts[:layout] = "layout" unless opts.has_key?(:layout)
  opts[:layout_opts] ||= (opts[:layout_opts] || {}).dup
  if layout = opts[:layout]
    layout = {:template=>layout} unless layout.is_a?(Hash)
    opts[:layout_opts] = opts[:layout_opts].merge(layout)
  end
  template_opts = opts[:template_opts] = (opts[:template_opts] || {}).dup
  template_opts[:outvar] ||= '@_out_buf'
  if RUBY_VERSION >= "1.9" && !template_opts.has_key?(:default_encoding)
    template_opts[:default_encoding] = Encoding.default_external
  end
  if opts[:escape]
    template_opts[:engine_class] = ErubisEscaping::Eruby
  end
  opts[:cache] = app.thread_safe_cache if opts.fetch(:cache, ENV['RACK_ENV'] != 'development')
  opts.extend(RodaDeprecateMutation)
  opts[:layout_opts].extend(RodaDeprecateMutation)
  opts[:template_opts].extend(RodaDeprecateMutation)
end

def self.load_dependencies(app, opts=OPTS)

def self.load_dependencies(app, opts=OPTS)
  if opts[:escape]
    app.plugin :_erubis_escaping
  end
end