kindle-feeds 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.0.3 / 2008-08-24
2
+
3
+ * Atom feeds scanned first before RSS
4
+
1
5
  === 1.0.2 / 2008-08-24
2
6
 
3
7
  * minor bugfixes and tweaks
@@ -51,8 +51,8 @@
51
51
 
52
52
  <% f.entries.each_with_index do |e, n| %>
53
53
  <a name="section-<%= i %>-feed-<%= j %>-entry-<%= n %>"></a>
54
- <h3>(<%= n + 1 %>/<%= f.entries.size %>) <a href="<%= e.url %>"><%= e.title %></a></h3>
55
- <div style="text-align:right"><i><%= e.date_published ? e.date_published.strftime('%B %d, %Y') : nil %></i></div>
54
+ <div style="text-align:right"><i><%= e.date_published ? e.date_published.strftime('%B %d, %Y') : nil %></i> (<%= n + 1 %>/<%= f.entries.size %>)</div>
55
+ <h3><a href="<%= e.url %>"><%= e.title %></a></h3>
56
56
  <div>
57
57
  <%= e.content %>
58
58
  </div>
data/lib/kindle-feeds.rb CHANGED
@@ -77,7 +77,7 @@ class Autodiscovery
77
77
  # <link rel="alternate" type="application/rss+xml" title="RSS"
78
78
  # href="http://feeds.feedburner.com/TheRssBlog">
79
79
  # Tricky: Hpricot CSS attribute selectors are written like XPath selectors
80
- [:rss, :atom].each do |flavor|
80
+ [:atom, :rss].each do |flavor|
81
81
  if x=@doc.at("head link[@type=application/#{flavor}+xml]")
82
82
  return x[:href]
83
83
  end
@@ -91,8 +91,15 @@ end
91
91
 
92
92
  class Feed
93
93
  def self.create_feed(xml, feed_url)
94
- feed = FeedNormalizer::FeedNormalizer.parse(xml)
95
- return nil unless feed.is_a?(FeedNormalizer::Feed)
94
+ begin
95
+ feed = FeedNormalizer::FeedNormalizer.parse(xml)
96
+ return nil unless feed.is_a?(FeedNormalizer::Feed)
97
+ rescue
98
+ puts "Error trying to parse feed: #{feed_url}"
99
+ puts $!
100
+ puts
101
+ return nil
102
+ end
96
103
  # clean up entries:
97
104
  ic = Iconv.new('ISO-8859-1//TRANSLIT', 'utf-8')
98
105
  ic2 = Iconv.new('ISO-8859-1//IGNORE', 'utf-8')
@@ -197,7 +204,7 @@ class Section
197
204
  end
198
205
 
199
206
  class KindleFeeds
200
- VERSION = "1.0.2"
207
+ VERSION = "1.0.3"
201
208
  attr_accessor :sections
202
209
  # config is a text file with a certain format
203
210
  def initialize(config)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kindle-feeds
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Choi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-24 00:00:00 -04:00
12
+ date: 2008-08-25 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency