feed_parser 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.3
data/Gemfile CHANGED
@@ -3,5 +3,10 @@ source :rubygems
3
3
  gem 'nokogiri'
4
4
 
5
5
  group :test do
6
+ gem 'rake'
6
7
  gem 'rspec'
7
8
  end
9
+
10
+ platform :jruby do
11
+ gem 'jruby-openssl'
12
+ end
data/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Rss and Atom feed parser built on top of Nokogiri. Supports custom sanitizers.
4
4
 
5
+ ## Build Status
6
+
7
+ [![Build Status](https://secure.travis-ci.org/arttu/feed_parser.png)](http://travis-ci.org/arttu/feed_parser)
8
+
9
+ FeedParser gem is tested on Ruby 1.8.7 and 1.9.3.
10
+
5
11
  ## Install
6
12
 
7
13
  Add to Gemfile
@@ -40,7 +46,7 @@ Install dependencies by running `bundle install`.
40
46
 
41
47
  Run rspec tests:
42
48
 
43
- $ bundle exec rspec
49
+ $ bundle exec rake spec
44
50
 
45
51
  ## Contributing
46
52
 
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'bundler'
4
+
5
+ begin
6
+ require 'rspec'
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts "Run `bundle install` to install rspec gem"
9
+ exit e.status_code
10
+ end
11
+
12
+ require 'rspec/core/rake_task'
13
+
14
+ desc "Run spec tests"
15
+ RSpec::Core::RakeTask.new('spec') do |t|
16
+ t.pattern = 'spec/**/*_spec.rb'
17
+ end
18
+
19
+ desc "Default: Run specs"
20
+ task :default => :spec
21
+
22
+ namespace :rubies do
23
+ desc "Run tests with three major Ruby versions"
24
+ task :specs do
25
+ run("rvm 1.8.7-p302@feed_parser,1.9.2-p0@feed_parser,1.9.3-p125@feed_parser do bundle exec rake spec")
26
+ end
27
+ end
data/lib/feed_parser.rb CHANGED
@@ -3,7 +3,7 @@ require 'nokogiri'
3
3
 
4
4
  class FeedParser
5
5
 
6
- VERSION = "0.3.0"
6
+ VERSION = "0.3.1"
7
7
 
8
8
  USER_AGENT = "Ruby / FeedParser gem"
9
9
 
@@ -40,10 +40,15 @@ class FeedParser
40
40
  private
41
41
  def possible_html_content(element)
42
42
  return '' if element.empty?
43
- if element.attribute("type") == "html"
44
- CGI.unescapeHTML(element.inner_html)
45
- else
46
- element.text
43
+ return element.text unless element.attribute("type")
44
+
45
+ case element.attribute("type").value
46
+ when 'html', 'text/html'
47
+ CGI.unescapeHTML(element.inner_html)
48
+ when 'xhtml'
49
+ element.xpath('*').to_xhtml
50
+ else
51
+ element.text
47
52
  end
48
53
  end
49
54
  end
@@ -196,6 +196,22 @@ describe FeedParser do
196
196
  :title => "Smashing Magazine",
197
197
  :url => "http://www.smashingmagazine.com/feed/atom/",
198
198
  # items: [] # <- fill in if you want to
199
+ },
200
+ 'facebook.atom.xml' => {
201
+ :items => [
202
+ {
203
+ :guid => "urn:uuid:132266233552163",
204
+ :link => "http://developers.facebook.com/blog/post/614/",
205
+ :title => "Breaking Change: JavaScript SDK to oauth:true on December 13th",
206
+ :categories=>[],
207
+ :author => "",
208
+ :description => "",
209
+ :content => '<div><p>As part of our continued efforts to migrate all apps to OAuth 2.0, we are opting in all apps using the new JavaScript SDK to OAuth 2.0 tomorrow at 11am Pacific Time. The deadline to support OAuth 2.0 was <a href="https://developers.facebook.com/docs/oauth2-https-migration/">October 1st, 2011</a>.</p>
210
+
211
+ <p>The new JS SDK with OAuth 2.0 was introduced in July. Tomorrow, on <b>December 13th at 11am</b>, we will automatically default the <code>oauth</code> param to true in <code>FB.init</code>. With this change, please ensure that you are using <code>FB.getAuthResponse</code> to obtain the access token. Read more about the specific changes that you need to make <a href="https://developers.facebook.com/blog/post/525/">here</a>.</p>
212
+ </div>'
213
+ }
214
+ ]
199
215
  }
200
216
  }.each do |atom_fixture, test_cases|
201
217
  it "should parse #{atom_fixture}" do
@@ -628,10 +628,10 @@ Please refer to the <a href="https://developers.facebook.com/roadmap">Platform R
628
628
  <updated>2011-12-12T17:00:00Z</updated>
629
629
  <id>urn:uuid:132266233552163</id>
630
630
  <link href="http://developers.facebook.com/blog/post/614/" rel="alternate" type="text/html"/>
631
- <content type="text/html" xml:lang="en"><![CDATA[<div><p>As part of our continued efforts to migrate all apps to OAuth 2.0, we are opting in all apps using the new JavaScript SDK to OAuth 2.0 tomorrow at 11am Pacific Time. The deadline to support OAuth 2.0 was <a href="https://developers.facebook.com/docs/oauth2-https-migration/">October 1st, 2011</a>.</p>
631
+ <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><p>As part of our continued efforts to migrate all apps to OAuth 2.0, we are opting in all apps using the new JavaScript SDK to OAuth 2.0 tomorrow at 11am Pacific Time. The deadline to support OAuth 2.0 was <a href="https://developers.facebook.com/docs/oauth2-https-migration/">October 1st, 2011</a>.</p>
632
632
 
633
633
  <p>The new JS SDK with OAuth 2.0 was introduced in July. Tomorrow, on <b>December 13th at 11am</b>, we will automatically default the <code>oauth</code> param to true in <code>FB.init</code>. With this change, please ensure that you are using <code>FB.getAuthResponse</code> to obtain the access token. Read more about the specific changes that you need to make <a href="https://developers.facebook.com/blog/post/525/">here</a>.</p>
634
- </div>]]></content>
634
+ </div></content>
635
635
  </entry>
636
636
  <entry>
637
637
  <title type="text">Facebook Social Games Hack Recap</title>
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.3.0
4
+ version: 0.3.1
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-16 00:00:00.000000000 Z
12
+ date: 2012-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
- requirement: &2156542160 !ruby/object:Gem::Requirement
16
+ requirement: &2152816100 !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: *2156542160
24
+ version_requirements: *2152816100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec-rails
27
- requirement: &2156541280 !ruby/object:Gem::Requirement
27
+ requirement: &2152815240 !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: *2156541280
35
+ version_requirements: *2152815240
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
@@ -42,9 +42,11 @@ extra_rdoc_files:
42
42
  - README.md
43
43
  files:
44
44
  - .gitignore
45
+ - .travis.yml
45
46
  - Gemfile
46
47
  - LICENSE
47
48
  - README.md
49
+ - Rakefile
48
50
  - feed_parser.gemspec
49
51
  - lib/feed_parser.rb
50
52
  - lib/feed_parser/dsl.rb
@@ -79,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
81
  version: '0'
80
82
  requirements: []
81
83
  rubyforge_project:
82
- rubygems_version: 1.8.11
84
+ rubygems_version: 1.8.10
83
85
  signing_key:
84
86
  specification_version: 3
85
87
  summary: Rss and Atom feed parser