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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7452ade635ade3314c5eb992de803b2ed6d103e0
4
- data.tar.gz: 90c7b2d34dd4d6070e06c589d5e01f5ebb5e76db
3
+ metadata.gz: 93fa92e0a04e5193bacf3e09a77cb8d25ddcff54
4
+ data.tar.gz: 7d1f0cd78ead23386d15345d0f356c75fe8c6e2a
5
5
  SHA512:
6
- metadata.gz: 09a7bfef009fdc001749a2695876d0c0adfcb12ca7cdce31ef494227cd9712133b6ba7a18ffd8340b7a2f233954f6e1cf83e1470b70052d9cb64ad66db24d0c8
7
- data.tar.gz: cf7b9884f2339f8e2cc99c0a17fc4170a3a97e7f59c9c1e0a0b40417f45c059d2df31d54253b6535f942915096b11e0592d2f8cd2ff735c0bb9edd5ae465afe8
6
+ metadata.gz: 93b0d6d8fc0bc0800cfd1f03cebb72d61720eaa348996752be1d04b06504130d453d59d6214d3813af050f17f37f40f0b807bc701ef4c3771dc957b45e129a9a
7
+ data.tar.gz: fb3faf6b214acd44e7f27dda0342f27b25ffe1decc2deeaf2267388d9ab109225aa4959d9099b9f0815f9b014bc24bbe93bbbe8533b94a57fc3ec1b06c8afd6c
@@ -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"
@@ -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.1'
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"
@@ -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.1
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-15 00:00:00.000000000 Z
14
+ date: 2014-04-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec