class Middleman::Server
def process_request(options={})
def process_request(options={}) # Normalize the path and add index if we're looking at a directory path = request.path path << settings.index_file if path.match(%r{/$}) path.gsub!(%r{^/}, '') old_layout = settings.current_layout settings.layout(options[:layout]) if !options[:layout].nil? result = render(path, :layout => settings.fetch_layout_path.to_sym) settings.layout(old_layout) if result content_type mime_type(File.extname(path)), :charset => 'utf-8' status 200 return result end status 404 rescue Padrino::Rendering::TemplateNotFound $stderr.puts "File not found: #{request.path}" status 404 end