Sha256: 292ad0d348c94cdba46fd285702c346148edc303020609811a959034eacf961e
Contents?: true
Size: 1.22 KB
Versions: 5
Compression:
Stored size: 1.22 KB
Contents
Shinmun::Blog.map do category '/categories/(.*)' do |name| category = find_category(name) render 'category.rhtml', :category => category, :posts => posts_by_category[category] end tag '/tags/(.*)' do |tag| render 'category.rhtml', :name => "Tag: #{tag}", :posts => posts_by_tag[tag] end post '/(\d+)/(\d+)/(.*)' do |year, month, name| if post = posts_by_date[year.to_i][month.to_i][name] render 'post.rhtml', :post => post else render '404.rhtml', :path => request.path_info end end archive '/(\d+)/(\d+)' do |year, month| render('archive.rhtml', :year => year.to_i, :month => month.to_i, :posts => posts_by_date[year.to_i][month.to_i].values) end feed '/index\.rss' do render 'index.rxml', :layout => false, :posts => posts[0, 20] end index '/$' do render 'index.rhtml', :posts => posts[0, 20] end page '/(.*)' do |path| path = path.gsub('..', '') if page = pages[path] render 'page.rhtml', :page => page elsif File.exist?("public/#{path}") file = Rack::File.new(nil) file.path = "public/#{path}" response.body = file else render '404.rhtml', :path => path end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
shinmun-1.0.3 | lib/shinmun/routes.rb |
shinmun-1.0.2 | lib/shinmun/routes.rb |
shinmun-1.0.1 | lib/shinmun/routes.rb |
shinmun-1.0 | lib/shinmun/routes.rb |
shinmun-0.9.2 | lib/shinmun/routes.rb |