bible_gateway 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/README.md +2 -2
- data/VERSION +1 -1
- data/lib/bible_gateway.rb +23 -5
- data/lib/bible_gateway/version.rb +1 -1
- data/spec/bible_gateway_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 936c48f6f63535b6b45f26270bd8f736b33547ee5143361a0ead5d3c9c9ab8f8
|
|
4
|
+
data.tar.gz: 93042e59fe2c1a5987337bf63f47fbda4742c0f6a365d78e0e3845ee610eb1ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '09d00df060704129a77c21eb1e3b1ad2d3576d61d420ab2d4adc155a19b479c0be19d4a648afc4a6cbf703a9c21a97fae21650b8f4bec13ff11fe7758b8036b3'
|
|
7
|
+
data.tar.gz: 66d98831f4cbb6243f10156ebe3c70894205351fbd50ef12dadf1c2bfc9c75ab1ff43828b25d321eadd4bd2301d17b9aee3e328365adec9e34c9d133189ddfbc
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# BibleGateway
|
|
2
2
|
|
|
3
3
|
Travis CI:
|
|
4
|
-
[](https://travis-ci.org/bibleable/bible_gateway)
|
|
5
|
+
1.9.3, 2.0.0, 2.1.1
|
|
6
6
|
|
|
7
7
|
An unofficial 'API' for BibleGateway.com.
|
|
8
8
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.12
|
data/lib/bible_gateway.rb
CHANGED
|
@@ -38,6 +38,10 @@ class BibleGateway
|
|
|
38
38
|
:louis_segond => "LSG",
|
|
39
39
|
:nouvelle_edition_de_geneve => "NEG1979",
|
|
40
40
|
:segond_21 => "SG21",
|
|
41
|
+
|
|
42
|
+
#Chinese
|
|
43
|
+
:chinese_new_version_simplified => "CNVS",
|
|
44
|
+
:chinese_union_version_simplified => "CUVS",
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
def self.versions
|
|
@@ -74,16 +78,30 @@ class BibleGateway
|
|
|
74
78
|
segment.search('sup.footnote').remove # remove footnote links
|
|
75
79
|
segment.search("div.crossrefs").remove # remove cross references
|
|
76
80
|
segment.search("div.footnotes").remove # remove footnotes
|
|
81
|
+
|
|
82
|
+
#scripture_text should be text
|
|
83
|
+
text = ""
|
|
77
84
|
segment.search("span.text").each do |span|
|
|
78
|
-
text
|
|
79
|
-
span.swap text
|
|
85
|
+
text += span.inner_text
|
|
80
86
|
end
|
|
81
87
|
|
|
88
|
+
# text should be html so that text can be used above.
|
|
89
|
+
segment.search("span.text").each do |span|
|
|
90
|
+
html_content = span.inner_html
|
|
91
|
+
span.swap html_content
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# text should be html so that text can be used above.
|
|
82
95
|
segment.search('sup.versenum').each do |sup|
|
|
83
|
-
|
|
84
|
-
sup.swap "<sup>#{
|
|
96
|
+
html_content = sup.content
|
|
97
|
+
sup.swap "<sup>#{html_content}</sup>"
|
|
85
98
|
end
|
|
99
|
+
|
|
86
100
|
content = segment.inner_html.gsub('<p></p>', '').gsub(/<!--.*?-->/, '').strip
|
|
87
|
-
|
|
101
|
+
|
|
102
|
+
#scripture_text should be text
|
|
103
|
+
{:title => title,
|
|
104
|
+
:content => content,
|
|
105
|
+
:text => text }
|
|
88
106
|
end
|
|
89
107
|
end
|
data/spec/bible_gateway_spec.rb
CHANGED
|
@@ -27,10 +27,16 @@ describe BibleGateway do
|
|
|
27
27
|
expect(gateway.version).to eq(:english_standard_version)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
it "should be able to set the chinese version to use" do
|
|
31
|
+
gateway = BibleGateway.new :chinese_new_version_simplified
|
|
32
|
+
expect(gateway.version).to eq(:chinese_new_version_simplified)
|
|
33
|
+
end
|
|
34
|
+
|
|
30
35
|
it "should raise an exception when changing to unknown version" do
|
|
31
36
|
gateway = BibleGateway.new
|
|
32
37
|
expect { gateway.version = :unknown_version }.to raise_error(BibleGatewayError)
|
|
33
38
|
end
|
|
39
|
+
|
|
34
40
|
end
|
|
35
41
|
|
|
36
42
|
describe "lookup" do
|
|
@@ -40,6 +46,11 @@ describe BibleGateway do
|
|
|
40
46
|
expect(title).to eq("John 1:1")
|
|
41
47
|
end
|
|
42
48
|
|
|
49
|
+
it "should find the passage title in chinese_new_version_simplified" do
|
|
50
|
+
title = BibleGateway.new(:chinese_new_version_simplified).lookup("John 1:1")[:title]
|
|
51
|
+
expect(title).to eq("约翰福音 1:1")
|
|
52
|
+
end
|
|
53
|
+
|
|
43
54
|
it "should find and clean the passage content" do
|
|
44
55
|
content = BibleGateway.new(:english_standard_version).lookup("John 1:1")[:content]
|
|
45
56
|
expect(content).to include("<h3>The Word Became Flesh</h3>")
|
|
@@ -53,6 +64,11 @@ describe BibleGateway do
|
|
|
53
64
|
expect(title).to eq("John 3")
|
|
54
65
|
end
|
|
55
66
|
|
|
67
|
+
it "should find the passage title in chinese_new_version_simplified" do
|
|
68
|
+
title = BibleGateway.new(:chinese_new_version_simplified).lookup("John 3")[:title]
|
|
69
|
+
expect(title).to eq("约翰福音 3")
|
|
70
|
+
end
|
|
71
|
+
|
|
56
72
|
it "should find and clean the passage content" do
|
|
57
73
|
content = BibleGateway.new(:english_standard_version).lookup("John 3")[:content]
|
|
58
74
|
expect(content).to include("<h3>You Must Be Born Again</h3>")
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bible_gateway
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Geoffrey Dagley
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-06-
|
|
11
|
+
date: 2020-06-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|