Skip to content

Commit

Permalink
Make use of Sinatra HEAD lastest features
Browse files Browse the repository at this point in the history
* #content_type helper (instead of #header)
* #sass helper instead of doing manual generation
  • Loading branch information
sr committed Apr 20, 2008
1 parent 8e2e329 commit ca42b9c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions git-wiki.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def to_s
configure do
GIT_REPOSITORY = ENV['HOME'] + '/wiki'
HOMEPAGE = 'Home'
haml_options :format => :html4
set_option :haml, :format => :html4

unless File.exists?(GIT_REPOSITORY) && File.directory?(GIT_REPOSITORY)
puts "Initializing repository in #{GIT_REPOSITORY}..."
Expand All @@ -80,14 +80,14 @@ def list_item(page)
end

before do
header 'Content-Type' => 'text/html; charset=utf-8'
content_type 'text/html', :charset => 'utf-8'
end

get('/') { redirect '/' + HOMEPAGE }

get('/_stylesheet.css') do
header 'Content-Type' => 'text/css; charset=utf-8'
Sass::Engine.new(template('stylesheet')).render
content_type 'text/css', :charset => 'utf-8'
sass :stylesheet
end

get '/_list' do
Expand All @@ -104,7 +104,7 @@ def list_item(page)
get '/:page.txt' do
@page = Page.new(params[:page])
throw :halt, [404, "Unknown page #{format[:page]}"] unless @page.tracked?
header 'Content-Type' => 'text/plain; charset=utf-8'
content_type 'text/plain', :charset => 'utf-8'
@page.raw_body
end

Expand Down

0 comments on commit ca42b9c

Please sign in to comment.