ruby-readability 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/readability.rb +2 -2
- data/ruby-readability.gemspec +1 -1
- data/spec/readability_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93fa92e0a04e5193bacf3e09a77cb8d25ddcff54
|
4
|
+
data.tar.gz: 7d1f0cd78ead23386d15345d0f356c75fe8c6e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93b0d6d8fc0bc0800cfd1f03cebb72d61720eaa348996752be1d04b06504130d453d59d6214d3813af050f17f37f40f0b807bc701ef4c3771dc957b45e129a9a
|
7
|
+
data.tar.gz: fb3faf6b214acd44e7f27dda0342f27b25ffe1decc2deeaf2267388d9ab109225aa4959d9099b9f0815f9b014bc24bbe93bbbe8533b94a57fc3ec1b06c8afd6c
|
data/lib/readability.rb
CHANGED
@@ -455,7 +455,7 @@ module Readability
|
|
455
455
|
content_length = el.text.strip.length # Count the text length excluding any surrounding whitespace
|
456
456
|
link_density = get_link_density(el)
|
457
457
|
|
458
|
-
reason = clean_conditionally_reason?(counts, content_length, options, weight, link_density)
|
458
|
+
reason = clean_conditionally_reason?(name, counts, content_length, options, weight, link_density)
|
459
459
|
if reason
|
460
460
|
debug("Conditionally cleaned #{name}##{el[:id]}.#{el[:class]} with weight #{weight} and content score #{content_score} because it has #{reason}.")
|
461
461
|
el.remove
|
@@ -464,7 +464,7 @@ module Readability
|
|
464
464
|
end
|
465
465
|
end
|
466
466
|
|
467
|
-
def clean_conditionally_reason?(counts, content_length, options, weight, link_density)
|
467
|
+
def clean_conditionally_reason?(name, counts, content_length, options, weight, link_density)
|
468
468
|
if counts["img"] > counts["p"]
|
469
469
|
"too many images"
|
470
470
|
elsif counts["li"] > counts["p"] && name != "ul" && name != "ol"
|
data/ruby-readability.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "ruby-readability"
|
6
|
-
s.version = '0.6.
|
6
|
+
s.version = '0.6.2'
|
7
7
|
s.authors = ["Andrew Cantino", "starrhorne", "libc", "Kyle Maxwell"]
|
8
8
|
s.email = ["andrew@iterationlabs.com"]
|
9
9
|
s.homepage = "http://github.com/cantino/ruby-readability"
|
data/spec/readability_spec.rb
CHANGED
@@ -541,4 +541,13 @@ describe Readability do
|
|
541
541
|
|
542
542
|
end
|
543
543
|
end
|
544
|
+
|
545
|
+
describe "clean_conditionally_reason?" do
|
546
|
+
let (:list_fixture) { "<div><p>test</p>#{'<li></li>' * 102}" }
|
547
|
+
|
548
|
+
it "does not raise error" do
|
549
|
+
@doc = Readability::Document.new(list_fixture)
|
550
|
+
expect { @doc.content }.to_not raise_error
|
551
|
+
end
|
552
|
+
end
|
544
553
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-readability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Cantino
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-04-
|
14
|
+
date: 2014-04-18 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|