Atom Feeds

Replaced Instiki's RSS 2.0 feeds with Atom 1.0 feeds.
This commit is contained in:
Jacques Distler 2007-04-13 17:04:03 -05:00
parent 81d71854c0
commit 3a57d3aade
6 changed files with 54 additions and 41 deletions

View file

@ -32,8 +32,8 @@
</style>
<%= javascript_include_tag :defaults %>
<% if @web %>
<%= auto_discovery_link_tag(:rss, :controller => 'wiki', :web => @web.address, :action => 'rss_with_headlines') %>
<%= auto_discovery_link_tag(:rss, :controller => 'wiki', :web => @web.address, :action => 'rss_with_content') %>
<%= auto_discovery_link_tag(:atom, :controller => 'wiki', :web => @web.address, :action => 'atom_with_headlines') %>
<%= auto_discovery_link_tag(:atom, :controller => 'wiki', :web => @web.address, :action => 'atom_with_content') %>
<% end %>
</head>

31
app/views/wiki/atom.rxml Normal file
View file

@ -0,0 +1,31 @@
xml.feed('xmlns' => "http://www.w3.org/2005/Atom", "xml:lang" => 'en') do
xml.title(@web.name)
xml.link( 'rel' => 'alternate', 'type' => "application/xhtml+xml", 'href' => url_for(:only_path => false, :web => @web_name, :action => @link_action, :id => 'HomePage') )
xml.link( 'rel' => 'self', 'href' => url_for(:only_path => false, :web => @web_name, :action => @hide_description? :atom_with_headlines : :atom_with_content ) )
xml.updated(@web.updated_at.getgm.strftime("%Y-%m-%dT%H:%M:%SZ") )
xml.id('tag:' + url_for(:only_path => false, :web => @web_name).split('/')[2].split(':')[0] + ',' + @web.created_at.getgm.strftime("%Y-%m-%d") + ':' + CGI.escape(@web.name) )
xml.subtitle('An Instiki Wiki')
xml.generator('Instiki', 'uri' => "http://golem.ph.utexas.edu/instiki/show/HomePage", 'version' => Instiki::VERSION::STRING)
for page in @pages_by_revision
xml.entry do
xml.title(page.plain_name, 'type' => "html")
xml.link('rel' => 'alternate', 'type' => 'application/xhtml+xml', 'href' => url_for(:only_path => false, :web => @web_name, :action => @link_action, :id => page.name) )
xml.updated(page.updated_at.getgm.strftime("%Y-%m-%dT%H:%M:%SZ") )
xml.published(page.created_at.getgm.strftime("%Y-%m-%dT%H:%M:%SZ") )
xml.id('tag:' +url_for(:only_path => false, :web => @web_name).split('/')[2].split(':')[0] + ',' + page.created_at.getgm.strftime("%Y-%m-%d") + ":" + @web.name + ',' + CGI.escape(page.name))
xml.author do
xml.name(page.author)
end
if @hide_description
xml.summary('Content suppressed.', 'type' => 'text')
else
xml.content('type' => 'xhtml', 'xml:base' => url_for(:only_path => false, :web => @web_name, :action => @link_action, :id => page.name) ) do
xml.div('xmlns' => 'http://www.w3.org/1999/xhtml' ) do
|x| x << rendered_content(page)
end
end
end
end
end
end

View file

@ -1,14 +1,14 @@
<% @title = "Feeds" %>
<p>You can subscribe to this wiki by RSS and get either just the headlines of the pages that change or the entire page.</p>
<p>You can subscribe to this wiki's Atom feed and get either just the headlines of the pages that change or the entire page.</p>
<ul id="feedsList">
<li>
<% if @rss_with_content_allowed %>
<%= link_to 'Full content (RSS 2.0)', :web => @web.address, :action => :rss_with_content %>
<%= link_to 'Full content (Atom 1.0)', :web => @web.address, :action => :atom_with_content %>
<% end %>
</li>
<li>
<%= link_to 'Headlines (RSS 2.0)', :web => @web.address, :action => :rss_with_headlines %>
<%= link_to 'Headlines (Atom 1.0)', :web => @web.address, :action => :atom_with_headlines %>
</li>
</ul>