ruby-readability 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +19 -0
- data/VERSION +1 -1
- data/lib/readability.rb +5 -5
- data/ruby-readability.gemspec +2 -2
- metadata +4 -4
data/README
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
Ruby Readability
|
2
|
+
|
3
|
+
Command line:
|
4
|
+
(sudo) gem install ruby-readability
|
5
|
+
|
6
|
+
Bundler:
|
7
|
+
gem "ruby-readability", :require => 'readability'
|
8
|
+
|
9
|
+
Example:
|
10
|
+
|
11
|
+
require 'rubygems'
|
12
|
+
require 'readability'
|
13
|
+
require 'open-uri'
|
14
|
+
|
15
|
+
source = open('http://lab.arc90.com/experiments/readability/').read
|
16
|
+
puts Readability::Document.new(source).content
|
17
|
+
|
18
|
+
===
|
19
|
+
|
1
20
|
This code is under the Apache License 2.0. http://www.apache.org/licenses/LICENSE-2.0
|
2
21
|
|
3
22
|
This is a ruby port of arc90's readability project
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
data/lib/readability.rb
CHANGED
@@ -183,13 +183,13 @@ module Readability
|
|
183
183
|
def score_node(elem)
|
184
184
|
content_score = class_weight(elem)
|
185
185
|
case elem.name.downcase
|
186
|
-
when "div"
|
186
|
+
when "div"
|
187
187
|
content_score += 5
|
188
|
-
when "blockquote"
|
188
|
+
when "blockquote"
|
189
189
|
content_score += 3
|
190
|
-
when "form"
|
190
|
+
when "form"
|
191
191
|
content_score -= 3
|
192
|
-
when "th"
|
192
|
+
when "th"
|
193
193
|
content_score -= 5
|
194
194
|
end
|
195
195
|
{ :content_score => content_score, :elem => elem }
|
@@ -277,7 +277,7 @@ module Readability
|
|
277
277
|
end
|
278
278
|
|
279
279
|
# Get rid of duplicate whitespace
|
280
|
-
node.to_html.gsub(/[\r\n\f]+/, "\n" ).gsub(/[\t
|
280
|
+
node.to_html.gsub(/[\r\n\f]+/, "\n" ).gsub(/[\t ]+/, " ")
|
281
281
|
end
|
282
282
|
|
283
283
|
def clean_conditionally(node, candidates, selector)
|
data/ruby-readability.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruby-readability}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Cantino", "starrhorne", "libc", "Kyle Maxwell"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-08}
|
13
13
|
s.default_executable = %q{readability}
|
14
14
|
s.description = %q{Port of arc90's readability project to ruby}
|
15
15
|
s.email = %q{andrew@iterationlabs.com}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-readability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Cantino
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2010-11-
|
21
|
+
date: 2010-11-08 00:00:00 -08:00
|
22
22
|
default_executable: readability
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|