def apply_layout(env, content, opts)
      if layout = env['layout']
        layout.format = opts[:format]
        layout.content = content
        layout.template_name = opts[:layout] if layout.template_name?(opts[:layout], opts)
        layout
      else
        content
      end
    end
def apply_layout(env, content, opts)
      if layout = env['layout']
        layout.format = opts[:format]
        layout.content = content
        layout.template_name = opts[:layout] if layout.template_name?(opts[:layout], opts)
        layout
      else
        content
      end
    end
Apply the layout if it exists
 @api private