respond_to do |format|
format.html # index.html.erb
format.json { render json: @comics.to_json(Comic.list_json_opt) }
+ format.atom
+ format.rss
end
end
respond_to do |format|
format.html # show.html.erb
format.json { render json: @comic.to_json(Comic.show_json_opt) }
+ format.atom
+ format.rss
end
end
res
end
+ def scenario
+ panels.map {|panel|
+ panel.scenario
+ }.join
+ end
+
+ def plain_scenario
+ panels.map {|panel|
+ panel.plain_scenario
+ }.join
+ end
+
end
--- /dev/null
+atom_feed(
+ :language => 'ja-JP',
+ :root_url => root_url,
+ :url => root_url(:format => :atom),
+ :id => root_url
+) do |feed|
+ feed.title MagicNumber['profile']['users']['caption']
+ feed.subtitle sanitize(MagicNumber['profile']['users']['description'], :tags => %w(a p img br))
+ feed.updated Time.now
+ feed.author {|author| author.name(MagicNumber['profile']['web_master'])}
+
+ @comics.each do |comic|
+ feed.entry(
+ comic,
+ :url => comic_url(comic),
+ :id => comic_url(comic),
+ :published => comic.updated_at,
+ :updated => comic.updated_at
+ ) do |item|
+ item.title(comic.title)
+ item.content(comic.title, :type => 'html')
+ item.author {|author| author.name(comic.author.name)}
+ end
+ end
+end
--- /dev/null
+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.title
+ xml.pubDate comic.updated_at.to_formatted_s(:rfc822)
+ xml.dc :creator, comic.author.name
+ end
+ end
+ end
+end
--- /dev/null
+atom_feed(
+ :language => 'ja-JP',
+ :root_url => root_url,
+ :url => root_url(:format => :atom),
+ :id => root_url
+) do |feed|
+ feed.title MagicNumber['profile']['users']['caption']
+ feed.subtitle sanitize(MagicNumber['profile']['users']['description'], :tags => %w(a p img br))
+ feed.updated Time.now
+ feed.author {|author| author.name(MagicNumber['profile']['web_master'])}
+
+ @comic.stories.each do |story|
+ feed.entry(
+ story.panel,
+ :url => panel_url(story.panel),
+ :id => panel_url(story.panel),
+ :published => story.panel.updated_at,
+ :updated => story.panel.updated_at
+ ) do |item|
+ item.title(story.panel.caption)
+ item.content(story.panel.scenario, :type => 'html')
+ item.author {|author| author.name(story.panel.author.name)}
+ end
+ end
+end
--- /dev/null
+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"
+
+ @comic.stories.each do |story|
+ xml.item do
+ xml.title story.panel.caption
+ xml.link panel_url(story.panel)
+ xml.guid panel_url(story.panel)
+ xml.description story.panel.plain_scenario
+ xml.pubDate story.panel.updated_at.to_formatted_s(:rfc822)
+ xml.dc :creator, story.panel.author.name
+ end
+ end
+ end
+end