summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--sample/rss/tdiary_plugin/rss-recent.rb18
2 files changed, 15 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 65754ee..97d3b47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* configure.in (RUBY_PROG_INSTALL): not add -p option to INSTALL.
diff --git a/sample/rss/tdiary_plugin/rss-recent.rb b/sample/rss/tdiary_plugin/rss-recent.rb
index f574135..7e6aad5 100644
--- a/sample/rss/tdiary_plugin/rss-recent.rb
+++ b/sample/rss/tdiary_plugin/rss-recent.rb
@@ -109,15 +109,7 @@ def rss_recent_cache_rss(url, cache_file, cache_time)
rescue ::RSS::UnknownConversionMethodError
end
- rss_recent_pubDate_to_dc_date(rss.channel)
- rss_infos = [
- [
- rss.channel.title,
- rss.channel.link,
- rss.channel.dc_date,
- rss.image && rss.image.url,
- ]
- ]
+ rss_infos = []
rss.items.each do |item|
rss_recent_pubDate_to_dc_date(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
rss_infos << [item.title, item.link, item.dc_date, image]
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)
rescue URI::InvalidURIError