1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* sample/rss/tdiary_plugin/rss-recent.rb (rss_recent_cache_rss):

use the first date information of items as site date information
  if channel doesn't have date information.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2005-04-16 08:04:50 +00:00
parent b51cd234cf
commit 4afc07a666
2 changed files with 15 additions and 9 deletions

View file

@ -1,3 +1,9 @@
Sat Apr 16 17:01:16 2005 Kouhei Sutou <kou@cozmixng.org>
* sample/rss/tdiary_plugin/rss-recent.rb (rss_recent_cache_rss):
use the first date information of items as site date information
if channel doesn't have date information.
Sat Apr 16 15:27:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Apr 16 15:27:03 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (RUBY_PROG_INSTALL): not add -p option to INSTALL. * configure.in (RUBY_PROG_INSTALL): not add -p option to INSTALL.

View file

@ -109,15 +109,7 @@ def rss_recent_cache_rss(url, cache_file, cache_time)
rescue ::RSS::UnknownConversionMethodError rescue ::RSS::UnknownConversionMethodError
end end
rss_recent_pubDate_to_dc_date(rss.channel) rss_infos = []
rss_infos = [
[
rss.channel.title,
rss.channel.link,
rss.channel.dc_date,
rss.image && rss.image.url,
]
]
rss.items.each do |item| rss.items.each do |item|
rss_recent_pubDate_to_dc_date(item) rss_recent_pubDate_to_dc_date(item)
if item.respond_to?(:image_item) and item.image_item if item.respond_to?(:image_item) and item.image_item
@ -127,6 +119,14 @@ def rss_recent_cache_rss(url, cache_file, cache_time)
end end
rss_infos << [item.title, item.link, item.dc_date, image] rss_infos << [item.title, item.link, item.dc_date, image]
end end
rss_recent_pubDate_to_dc_date(rss.channel)
rss_infos.unshift([
rss.channel.title,
rss.channel.link,
rss.channel.dc_date ||
rss.items.collect{|item| item.dc_date}.compact.first,
rss.image && rss.image.url,
])
rss_recent_write_to_cache(cache_file, rss_infos) rss_recent_write_to_cache(cache_file, rss_infos)
rescue URI::InvalidURIError rescue URI::InvalidURIError