spix_parser 1.7.2 → 1.7.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/lib/spix_parser/parser.rb +2 -2
- data/lib/spix_parser/version.rb +1 -1
- data/spec/spix_parser/parser_spec.rb +19 -1
- metadata +3 -3
data/lib/spix_parser/parser.rb
CHANGED
@@ -32,8 +32,8 @@ module Spix
|
|
32
32
|
extend self
|
33
33
|
|
34
34
|
def format_links(options)
|
35
|
-
text = options[:text]
|
36
|
-
site_url = options[:site_url]
|
35
|
+
text = Sanitizer.html_decode options[:text]
|
36
|
+
site_url = Sanitizer.html_decode options[:site_url]
|
37
37
|
|
38
38
|
parse_links(text)
|
39
39
|
parse_images(text, site_url)
|
data/lib/spix_parser/version.rb
CHANGED
@@ -15,6 +15,24 @@ describe Spix::Parser do
|
|
15
15
|
feed.feed_items.should have(1).item
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
describe "#parse_images" do
|
20
|
+
|
21
|
+
it "should parse correctly images with relative paths" do
|
22
|
+
feed = Spix::Parser.parse(load_fixture('feed_with_relative_images.atom'), :mode => :local)
|
23
|
+
feed.feed_items.first.content[/<img.*src=["'](.*?)["'].*\/>/, 1].should == "http://news.google.com/news/tbn/VTvDRZJQdOtwRM/6.jpg"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should parse correctly images with absolute with the same domain" do
|
27
|
+
feed = Spix::Parser.parse(load_fixture('feed_with_absolute_images_from_the_same_domain.atom'), :mode => :local)
|
28
|
+
feed.feed_items.first.content[/<img.*src=["'](.*?)["'].*\/>/, 1].should == "http://news.google.com/news/tbn/VTvDRZJQdOtwRM/6.jpg"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should parse correctly images with absolute with another domain" do
|
32
|
+
feed = Spix::Parser.parse(load_fixture('feed_with_absolute_images_from_another_domain.atom'), :mode => :local)
|
33
|
+
feed.feed_items.first.content[/<img.*src=["'](.*?)["'].*\/>/, 1].should == "http://oglobo.globo.com/fotos/2011/07/06/06_MHB_ballmer.jpg"
|
34
|
+
end
|
35
|
+
end
|
18
36
|
|
19
37
|
describe "rss parsing" do
|
20
38
|
it 'should parse from a file path' do
|
@@ -39,4 +57,4 @@ describe Spix::Parser do
|
|
39
57
|
end
|
40
58
|
end
|
41
59
|
|
42
|
-
end
|
60
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: spix_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.7.
|
5
|
+
version: 1.7.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Marcio Lopes de Faria
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-07-
|
14
|
+
date: 2011-07-12 00:00:00 -03:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.2.
|
47
|
+
version: 0.2.1
|
48
48
|
type: :runtime
|
49
49
|
version_requirements: *id003
|
50
50
|
- !ruby/object:Gem::Dependency
|