Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Feed: Use full URL for entry links; set <updated>.

Relative URLs for entries confused TwitterFeed.com, so we now use the full
URL.

Previously, the <updated> element of <feed> wasn't dynamic. Now it's set to
the date of the most recent entry.
  • Loading branch information...
commit 8f68074cdb2c974161b8c69f991af9f5ee5e8a7b 1 parent b95dc6d
@runpaint authored
Showing with 7 additions and 6 deletions.
  1. +4 −2 Rakefile
  2. +3 −4 templates/atom.atom
View
6 Rakefile
@@ -147,9 +147,11 @@ task :html => SOURCE_HTML do |t|
result({:toc => toc.dup.reject{|e| e[:type] == :subsection}})
mkdir_p 'output/toc'
File.open('output/toc/index.html','w') {|file| file.puts page}
+ recipes_by_time = toc.reject{|e| e[:type] == :subsection}.
+ sort_by{|e| e[:time]}.reverse
page = Erubis::Eruby.new(File.open('templates/atom.atom').read).
- result({:toc => toc.
- reject{|e| e[:type] == :subsection}.sort_by{|e| e[:time]}.reverse
+ result({:toc => recipes_by_time,
+ :updated => recipes_by_time.first[:time]
})
File.open('output/index.atom','w') {|file| file.puts page}
end
View
7 templates/atom.atom
@@ -3,7 +3,6 @@
xmlns:thr="http://purl.org/syndication/thread/1.0">
<link rel="self" href="http://vim.runpaint.org/index.atom"/>
<id>http://vim.runpaint.org/index.atom</id>
-
<title>Vim Recipes</title>
<subtitle>A cookbook for the Vim text editor</subtitle>
<author>
@@ -11,18 +10,18 @@
<email>runrun@runpaint.org</email>
<uri>http://runpaint.org/</uri>
</author>
- <updated>2009-05-13T08:42:22-04:00</updated> <!-- FIXME -->
+ <% require 'time' %>
+ <updated><%= updated.xmlschema %></updated>
<link href="http://vim.runpaint.org/"/>
<link rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"/>
<%
- require 'time'
toc.each do |entry|
next unless entry[:type] == :recipe
%>
<entry>
<id>tag:vim.runpaint.org,2009:<%= entry[:id] %></id>
- <link href="/<%= entry[:section_id] %>/<%= entry[:id] %>/"/>
+ <link href="http://vim.runpaint.org/<%= entry[:section_id] %>/<%= entry[:id] %>/"/>
<title><%= entry[:title] %></title>
<updated><%= entry[:time].xmlschema %></updated>
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
Please sign in to comment.
Something went wrong with that request. Please try again.