lib/sinatra/documentation.rb in sinatra-documentation-0.0.1 vs lib/sinatra/documentation.rb in sinatra-documentation-0.0.2

- old
+ new

@@ -6,10 +6,11 @@ module Documentation extend Sinatra::Extension mime_type :readme, 'text/html' set :default_content, :html + set :html_triggers_documentation, true before do # Let through sinatra image urls in development next if self.class.development? && request.path_info =~ %r{/__sinatra__/.*?.png} unless settings.static? && settings.public_folder? && (request.get? || request.head?) && static_file?(request.path_info) @@ -45,10 +46,12 @@ super end end get '/*' do - pass unless format == :readme + pass if format != :readme and (request.preferred_type == 'text/html' and !settings.html_triggers_documentation) + pass if self.class.development? && request.path_info =~ %r{/__sinatra__/.*?.png} + cache_control :public, :max_age => 300 render(:markdown, :"#{request.path}") end end end