Sha256: 451e804db525f4276ce556f6731eabc720f6caf5dfdc2cbf42f698fed0aad61a
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
# coding: utf-8 require 'builder' require 'uri' module Retter class Pages::Feed include Page def pathname config.retter_home.join('entries.rss') end def print pathname.open('w') {|f| f.puts rss } end private def entry_url(date, id = nil) (URI.parse(config.url) + date.strftime('/entries/%Y%m%d.html')).to_s end def rss xml = Builder::XmlMarkup.new xml.instruct! xml.rdf:RDF, :xmlns => 'http://purl.org/rss/1.0/', :'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', :'xmlns:dc' => 'http://purl.org/dc/elements/1.1/', :'xml:lang' => 'ja' do xml.channel :'rdf:about' => config.url do xml.title config.title xml.link config.url xml.dc:date, entries.empty? ? nil : entries.first.date xml.description config.description xml.items { xml.rdf(:Seq) { entries.each {|e| xml.rdf:li, :'rdf:resource' => entry_url(e.date) } } } end entries[0...20].each do |entry| # XXX hardcoding xml.item about: entry_url(entry.date) do xml.title entry.date.strftime('%Y/%m/%d') xml.description { xml.cdata! entry.body } xml.dc:date, entry.date xml.link entry_url(entry.date) xml.author config.author end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
retter-0.2.2 | lib/retter/pages/feed.rb |
retter-0.2.1 | lib/retter/pages/feed.rb |