Shinmun::Blog.map do get '/categories/(.*)\.rss' do |category| render 'category.rxml', find_category(category).merge(:layout => false) end get '/categories/(.*)' do |category| render 'category.rhtml', find_category(category) end get '/tags/(.*)' do |tag| render 'category.rhtml', :name => "Tag: #{tag}", :posts => posts.select { |p| p.tag_list.include?(tag) } end get '/(\d+)/(\d+)/(.*)' do |year, month, name| post = find_post(year.to_i, month.to_i, name) render 'post.rhtml', :post => post, :comments => comments_for(post.path) end get '/(\d+)/(\d+)' do |year, month| render 'archive.rhtml', :year => year.to_i, :month => month.to_i, :posts => posts_for_month(year.to_i, month.to_i) end get '/index\.rss' do render 'index.rxml', :layout => false end post '/comments' do if params['preview'] == 'true' render '_comments.rhtml', :comments => [Shinmun::Comment.new(params)] else post_comment(params['path'], params) render '_comments.rhtml', :comments => comments_for(params['path']) end end get '/assets/javascripts\.js' do scripts = assets['javascripts'].to_a.join if_none_match(etag(scripts)) { scripts } end get '/assets/stylesheets\.css' do styles = assets['stylesheets'].to_a.join if_none_match(etag(styles)) { styles } end get '/assets/(.*)' do |path| file = assets[path] or raise "#{path} not found" if_none_match(etag(file)) { file } end map '/admin' do use(Class.new do def initialize(app); @app = app; end def call(env) if env['HTTP_HOST'] == 'localhost:9292' @app.call(env) else [401, {}, '