dq-readability 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/dq-readability.gemspec +2 -2
- data/lib/dq-readability.rb +19 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTMyZTFmYTVhZjFjNmJhOWJmMjRiNTlmM2U0NTQ4NjA3NjczYmRlNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWZlN2Y5NmRlOTYyOWU5MGI2YzVhNDBlMDIyYTQwZmVmZWEzZTgyMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWNmNTY5NWZkMDZjZGQzNzhkNjRkNWRhMjEzMTUxZWY1ZWRiZmE4YTI0ZjE4
|
10
|
+
MzhjNjdkMjRhZDkxZTVhYTlkNTZiODNiNmQ1MmM1YTI1NWE4OWZjOTE1Yzhi
|
11
|
+
ZTg0MDcyMWZlZGVmOGZjNmI5NGYwODg4OWNmZTk1MmVlYWQ2Yjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmM2YzdjMjA4MDNlZTZiNDMyYzlmNjcxZTI1YjI5MjA3NDQ0Yjg5ZDVjM2E0
|
14
|
+
ZTg5OTRkYjEzMDMyZDdkMjRjNGI1YjVkODA4Y2YzZTQwZGQ0YzRkYWMzOWYx
|
15
|
+
MzNkMDFjZmY2MTRlMzE2N2JkNDVjMDg3NDdjZDMyMGUzMzFiZmM=
|
data/dq-readability.gemspec
CHANGED
@@ -3,12 +3,12 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "dq-readability"
|
6
|
-
s.version = '1.0.
|
6
|
+
s.version = '1.0.6'
|
7
7
|
s.authors = ["Prateek Papriwal"]
|
8
8
|
s.email = ["papriwalprateek@gmail.com"]
|
9
9
|
s.homepage = "http://github.com/DaQwest/dq-readability"
|
10
10
|
s.summary = %q{Port of arc90's readability project to ruby}
|
11
|
-
s.description = %q{Extracts main content of the webpage. Presents in good readable format.}
|
11
|
+
s.description = %q{Extracts main content of the webpage. Presents in good readable format. This gem is actively used to display articles in http://algorithm.daqwest.com}
|
12
12
|
|
13
13
|
s.rubyforge_project = "dq-readability"
|
14
14
|
|
data/lib/dq-readability.rb
CHANGED
@@ -18,7 +18,8 @@ module DQReadability
|
|
18
18
|
:min_image_width => 130,
|
19
19
|
:min_image_height => 80,
|
20
20
|
:ignore_image_format => [],
|
21
|
-
:bypass => false
|
21
|
+
:bypass => false,
|
22
|
+
:math => false
|
22
23
|
}.freeze
|
23
24
|
|
24
25
|
REGEXES = {
|
@@ -53,6 +54,7 @@ module DQReadability
|
|
53
54
|
@clean_conditionally = @options[:clean_conditionally]
|
54
55
|
@best_candidate_has_image = true
|
55
56
|
@bypass = @options[:bypass]
|
57
|
+
@math = @options[:math]
|
56
58
|
make_html
|
57
59
|
end
|
58
60
|
|
@@ -554,8 +556,22 @@ module DQReadability
|
|
554
556
|
html = node.serialize(:save_with => save_opts)
|
555
557
|
|
556
558
|
# Get rid of duplicate whitespace
|
557
|
-
|
558
|
-
|
559
|
+
if @math == false
|
560
|
+
html = "<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'></head>" + "\n" + html.gsub(/[\r\n\f]+/, "\n" )
|
561
|
+
else
|
562
|
+
head = <<HTML
|
563
|
+
<head><meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
|
564
|
+
<script type='text/x-mathjax-config'>
|
565
|
+
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\\\(','\\\\)']]}});
|
566
|
+
</script>
|
567
|
+
<script type='text/javascript'
|
568
|
+
src='http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'>
|
569
|
+
</script>
|
570
|
+
</head>
|
571
|
+
HTML
|
572
|
+
|
573
|
+
html = head + "\n" + html.gsub(/[\r\n\f]+/, "\n" )
|
574
|
+
end
|
559
575
|
|
560
576
|
# get rid of incompitable characters
|
561
577
|
if html.encode('utf-8').include?('Â')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dq-readability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Prateek Papriwal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -81,6 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.0.4
|
83
83
|
description: Extracts main content of the webpage. Presents in good readable format.
|
84
|
+
This gem is actively used to display articles in http://algorithm.daqwest.com
|
84
85
|
email:
|
85
86
|
- papriwalprateek@gmail.com
|
86
87
|
executables:
|