html2text 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +9 -2
- data/lib/html2text.rb +1 -0
- data/lib/html2text/version.rb +1 -1
- data/spec/examples/non-breaking-spaces.html +1 -0
- data/spec/examples/non-breaking-spaces.txt +1 -0
- data/spec/html2text_spec.rb +21 -0
- metadata +19 -15
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NjlhZDRjZjg4MjhjMjcxNGJkNzcyMDg5Mzk0Y2Q0MjA4MTM2MDJmMg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d9d1e3d127f188654b6c1bd3bc1d0d23e560a016
|
4
|
+
data.tar.gz: 66f15432e17bacea897e9d3930063e3dd69daae4
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OGU4NGM3ZjYwZGJjYzdmZWFlZWUyMzBkNTI1MzIxZDFhMjIwM2E1ZmI2NDI0
|
11
|
-
ZDk3ODViYmRkZGQ4MWUwNmRkMzFmOTE2NjQ3ZWRkZmQ0M2NlYzI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OWQ3MzM4ZTkyODA2ZmE0YThjZTA5MjhjYTQ1YzNiYjhjMzJmNWUyMDViNDE5
|
14
|
-
NGMxNGJjZDAwYzZjODJlYWRhOTc5NjY0YmFhNTZlOGFlMzNiNzE1ODE5Njgw
|
15
|
-
MmY0ODNmZDMzZTdkNjNjNTBmNTRmNzBjNTY3NDNhMjg0YjlmZWQ=
|
6
|
+
metadata.gz: 96f7a7852c88aea08df6f6701fd05dd06281c133c07d7dd5638c4b226060d5fb94cfba2461480ac6ab2b8909bda77278f6bb9500e4cd4f5e14776550c010fd63
|
7
|
+
data.tar.gz: c2769c466657cb18464bbb475bd6adfede83d61effc8e5f643f411da1d32dcd5952477950d0872afcdd86db50dd17af8c6d0e0d711d9b419a67b03be53b32257
|
data/README.md
CHANGED
@@ -44,7 +44,13 @@ See the [original blog post](http://journals.jevon.org/users/jevon-phd/entry/198
|
|
44
44
|
|
45
45
|
## Installing
|
46
46
|
|
47
|
-
|
47
|
+
Add [the gem](https://rubygems.org/gems/html2text) into your Gemfile and run `bundle install`:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
gem 'html2text'
|
51
|
+
```
|
52
|
+
|
53
|
+
Then you can:
|
48
54
|
|
49
55
|
```ruby
|
50
56
|
require 'html2text'
|
@@ -67,4 +73,5 @@ rspec
|
|
67
73
|
|
68
74
|
## Other versions
|
69
75
|
|
70
|
-
|
76
|
+
1. [html2text](https://github.com/soundasleep/html2text), the original PHP implementation.
|
77
|
+
2. [actionmailer-html2text](https://github.com/soundasleep/actionmailer-html2text), automatically generate text parts for HTML emails sent with ActionMailer.
|
data/lib/html2text.rb
CHANGED
data/lib/html2text/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
these spaces are non-breaking
|
@@ -0,0 +1 @@
|
|
1
|
+
these spaces are non-breaking
|
data/spec/html2text_spec.rb
CHANGED
@@ -19,6 +19,27 @@ describe Html2Text do
|
|
19
19
|
expect(text).to eq("hello world")
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
context "input value is non-string" do
|
24
|
+
let(:html) { nil }
|
25
|
+
it '(nil)' do
|
26
|
+
expect(text).to eq("")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context "input value is non-string" do
|
31
|
+
let(:html) { 1234 }
|
32
|
+
it "(number)" do
|
33
|
+
expect(text).to eq("1234")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "input value is non-string" do
|
38
|
+
let(:html) { 1234.5600 }
|
39
|
+
it "(float number)" do
|
40
|
+
expect(text).to eq("1234.56")
|
41
|
+
end
|
42
|
+
end
|
22
43
|
end
|
23
44
|
|
24
45
|
describe "#remove_leading_and_trailing_whitespace" do
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html2text
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jevon Wright
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec-collection_matchers
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: colorize
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: A Ruby component to convert HTML into a plain text format.
|
@@ -105,6 +105,8 @@ files:
|
|
105
105
|
- spec/examples/more-anchors.txt
|
106
106
|
- spec/examples/nbsp.html
|
107
107
|
- spec/examples/nbsp.txt
|
108
|
+
- spec/examples/non-breaking-spaces.html
|
109
|
+
- spec/examples/non-breaking-spaces.txt
|
108
110
|
- spec/examples/table.html
|
109
111
|
- spec/examples/table.txt
|
110
112
|
- spec/examples/test3.html
|
@@ -124,17 +126,17 @@ require_paths:
|
|
124
126
|
- lib
|
125
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
128
|
requirements:
|
127
|
-
- -
|
129
|
+
- - ">="
|
128
130
|
- !ruby/object:Gem::Version
|
129
131
|
version: '0'
|
130
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
133
|
requirements:
|
132
|
-
- -
|
134
|
+
- - ">="
|
133
135
|
- !ruby/object:Gem::Version
|
134
136
|
version: '0'
|
135
137
|
requirements: []
|
136
138
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.6.13
|
138
140
|
signing_key:
|
139
141
|
specification_version: 4
|
140
142
|
summary: Convert HTML into plain text.
|
@@ -153,6 +155,8 @@ test_files:
|
|
153
155
|
- spec/examples/more-anchors.txt
|
154
156
|
- spec/examples/nbsp.html
|
155
157
|
- spec/examples/nbsp.txt
|
158
|
+
- spec/examples/non-breaking-spaces.html
|
159
|
+
- spec/examples/non-breaking-spaces.txt
|
156
160
|
- spec/examples/table.html
|
157
161
|
- spec/examples/table.txt
|
158
162
|
- spec/examples/test3.html
|