From f618c927a539e72af09ed358c70255702fe74426 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Tue, 9 Aug 2011 22:18:34 +0200 Subject: [PATCH] added the atom feed --- page.rb | 5 +++++ views/atom.haml | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 views/atom.haml diff --git a/page.rb b/page.rb index f8247d2..2c60050 100644 --- a/page.rb +++ b/page.rb @@ -43,6 +43,11 @@ class Blog < Sinatra::Base Post.get_released(params[:id]).acknowledged_comments.to_json end + get '/atom.xml' do + @posts = Post.get_page(0) + haml :atom, :layout => false + end + get '/stylesheet.css' do scss :stylesheet end diff --git a/views/atom.haml b/views/atom.haml new file mode 100644 index 0000000..5d8970b --- /dev/null +++ b/views/atom.haml @@ -0,0 +1,16 @@ +!!! XML +%feed{:xmlns => 'http://www.w3.org/2005/Atom'} + %title="zero-knowledge" + %subtitle="scripting, programming and administrating" + %link{:href => '/'} + %link{:type => 'application/atom+xml', :rel => "self", :href => '/atom.xml'} + -@posts.each do |post| + %entry + %id="/post/#{post.id}" + %link{:type => 'text/html', :rel => "alternate", :href => "/post/#{post.id}"} + %title=post.title + %updated=post.written + %author + %name=post.account.username + %summary{:type => 'html'}=markup(post.content, post.markup).match(/.*?<\/p>/m)[0] + %content{:type => 'html'}=markup(post.content, post.markup) \ No newline at end of file