Skip to content

Instantly share code, notes, and snippets.

@wycats
Created December 29, 2008 04:22
Show Gist options
  • Save wycats/41173 to your computer and use it in GitHub Desktop.
Save wycats/41173 to your computer and use it in GitHub Desktop.
xml.instruct!
xml.text! xml_stylesheet 'main'
xml.text! xml_stylesheet 'coderay'
xml.feed(:xmlns => "http://www.w3.org/2005/Atom", 'xml:base' => feed[:url]) do
unless tags
xml.title "Blog Posts : #{Nex3::Config['blog']['name']}"
else
xml.title "Blog Posts About #{tags.map(&:titleize).to_sentence} : #{Nex3::Config['blog']['name']}"
end
xml.id feed[:url]
xml.updated @posts[0].created_at.xmlschema
xml.icon image_path('favicon.png')
xml.author do
xml.name feed[:name]
xml.email feed[:email]
xml.uri feed[:url]
end
xml.link(:rel => 'self', :href => posts_path + '.atom')
xml.link(:rel => 'alternate', :type => 'text/html', :href => 'posts')
for post in @posts
xml.entry do
xml.id post.uid
xml.title h post.title
xml.updated post.updated_at.xmlschema
xml.published post.created_at.xmlschema
xml.author do
xml.name feed[:name]
xml.email feed[:email]
xml.uri feed[:url]
for tag in post.tags
xml.category(:term => tag.name, :label => tag.name.titleize)
end
xml.content(:type => 'xhtml') do
xml.div(:id => "content", :xmlns => "http://www.w3.org/1999/xhtml") do
xml.text! stylesheet_link_tag 'main'
xml.text! stylesheet_link_tag 'coderay'
xml.text! post_content post
end
end
xml.link(:rel => 'alternate', :href => post_path(post))
end
end
end
!!! XML
= xml_stylesheet 'main'
= xml_stylesheet 'coderay'
%feed{:xmlns => "http://www.w3.org/2005/Atom", 'xml:base' => feed[:url]}
- unless tags
%title== Blog Posts : #{Nex3::Config['blog']['name']}
- else
%title== Blog Posts About #{tags.map(&:titleize).to_sentence} : #{Nex3::Config['blog']['name']}
%id= feed[:url]
%updated= @posts[0].created_at.xmlschema
%icon= image_path('favicon.png')
%author
%name= feed[:name]
%email= feed[:email]
%uri= feed[:url]
%link{:rel => 'self', :href => posts_path + '.atom'}/
%link{:rel => 'alternate', :type => 'text/html', :href => 'posts'}/
- for post in @posts
%entry
%id= post.uid
%title= h post.title
%updated= post.updated_at.xmlschema
%published= post.created_at.xmlschema
%author
%name= feed[:name]
%email= feed[:email]
%uri= feed[:url]
- for tag in post.tags
%category{:term => tag.name, :label => tag.name.titleize}/
%content{:type => 'xhtml'}
#content{:xmlns => "http://www.w3.org/1999/xhtml"}
= stylesheet_link_tag 'main'
= stylesheet_link_tag 'coderay'
= post_content post
%link{:rel => 'alternate', :href => post_path(post)}/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment