module Roda::RodaPlugins::Render::InstanceMethods

def find_template(opts)

template block, and locals to use for the render in the passed options.
Given the template name and options, set the template class, template path/content,
def find_template(opts)
  render_opts = self.class.opts[:render]
  engine_override = opts[:engine]
  engine = opts[:engine] ||= render_opts[:engine]
  if content = opts[:inline]
    path = opts[:path] = content
    template_class = opts[:template_class] ||= ::Tilt[engine]
    opts[:template_block] = self.class.inline_template_block(content)
  else
    opts[:views] ||= render_opts[:views]
    path = opts[:path] ||= template_path(opts)
    template_class = opts[:template_class]
    opts[:template_class] ||= ::Tilt
  end
  if (cache = opts[:cache]).nil?
    cache = content || !opts[:template_block]
  end
  if cache
    unless opts.has_key?(:cache_key)
      template_block = opts[:template_block] unless content
      template_opts = opts[:template_opts]
      opts[:cache_key] = if template_class || engine_override || template_opts || template_block
        [path, template_class, engine_override, template_opts, template_block]
      else
        path
      end
    end
  else
    opts.delete(:cache_key)
  end
  opts
end