OSDN Git Service

t#32046:
[pettanr/pettanr.git] / app / views / comics / index.rss.builder
diff --git a/app/views/comics/index.rss.builder b/app/views/comics/index.rss.builder
new file mode 100644 (file)
index 0000000..b319a9d
--- /dev/null
@@ -0,0 +1,24 @@
+xml.instruct!
+xml.rss("version"    => "2.0",
+        "xmlns:dc"   => "http://purl.org/dc/elements/1.1/",
+        "xmlns:atom" => "http://www.w3.org/2005/Atom") do
+  xml.channel do
+    xml.title       MagicNumber['profile']['users']['caption']
+    xml.link        root_url
+    xml.pubDate     Time.now.rfc822
+    xml.description sanitize(MagicNumber['profile']['users']['description'], :tags => %w(a p img br))
+    xml.atom :link, "href" => @rss_url, "rel" => "self", "type" => "application/rss+xml"
+    @comics.each do |comic|
+      xml.item do
+        xml.title        comic.title
+        xml.link         comic_url(comic)
+        xml.guid         comic_url(comic)
+        xml.description  comic.description
+        xml.pubDate      comic.updated_at.to_formatted_s(:rfc822)
+        xml.dc :creator, comic.author.name
+      end
+    end
+  end
+end