feed_parser 0.2.7 → 0.2.8

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.
@@ -3,7 +3,7 @@ require 'nokogiri'
3
3
 
4
4
  class FeedParser
5
5
 
6
- VERSION = "0.2.7"
6
+ VERSION = "0.2.8"
7
7
 
8
8
  USER_AGENT = "Ruby / FeedParser gem"
9
9
 
@@ -7,7 +7,7 @@ class FeedParser
7
7
  raw_feed = open_or_follow_redirect(feed_url)
8
8
  @feed = Nokogiri::XML(raw_feed)
9
9
  @feed.remove_namespaces!
10
- @type = ((@feed.search('rss')[0] && :rss) || (@feed.search('/feed/title')[0] && :atom))
10
+ @type = ((@feed.xpath('/rss')[0] && :rss) || (@feed.xpath('/feed')[0] && :atom))
11
11
  raise FeedParser::UnknownFeedType.new("Feed is not an RSS feed or an ATOM feed") unless @type
12
12
  self
13
13
  end
@@ -6,8 +6,8 @@ class FeedParser
6
6
  @guid = item.xpath(Dsl[@type][:item_guid]).text
7
7
  @title = item.xpath(Dsl[@type][:item_title]).text
8
8
  @author = item.xpath(Dsl[@type][:item_author]).text
9
- @description = possible_text(item.xpath(Dsl[@type][:item_description]))
10
- @content = possible_text(item.xpath(Dsl[@type][:item_content]))
9
+ @description = possible_html_content(item.xpath(Dsl[@type][:item_description]))
10
+ @content = possible_html_content(item.xpath(Dsl[@type][:item_content]))
11
11
  self
12
12
  end
13
13
 
@@ -36,8 +36,8 @@ class FeedParser
36
36
  end
37
37
 
38
38
  private
39
- def possible_text(element)
40
- element && element.text || ''
39
+ def possible_html_content(element)
40
+ element && element.inner_html || ''
41
41
  end
42
42
  end
43
43
 
@@ -138,7 +138,7 @@ describe FeedParser do
138
138
  :title => "Comment posted: Re: Howdy how?",
139
139
  :categories => [],
140
140
  :author => "Ffuuuuuuu- Le.",
141
- :description => "<div>trololooo</div><p>Company: awesome | Project: Awesome project</p>",
141
+ :description => "&lt;div&gt;trololooo&lt;/div&gt;&lt;p&gt;Company: awesome | Project: Awesome project&lt;/p&gt;",
142
142
  :content => ""
143
143
  }
144
144
  ]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feed_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-07 00:00:00.000000000 Z
12
+ date: 2012-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &2152406380 !ruby/object:Gem::Requirement
16
+ requirement: &2156485020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152406380
24
+ version_requirements: *2156485020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec-rails
27
- requirement: &2152404940 !ruby/object:Gem::Requirement
27
+ requirement: &2156483560 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '2.6'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2152404940
35
+ version_requirements: *2156483560
36
36
  description: Rss and Atom feed parser with sanitizer support built on top of Nokogiri.
37
37
  email:
38
38
  - arttu.tervo@gmail.com