kjlite 0.1.0 → 0.3.0
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
- checksums.yaml.gz.sig +0 -0
- data/lib/kjlite.rb +24 -21
- data.tar.gz.sig +0 -0
- metadata +29 -28
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9828f3ba1ba9e27da83bdd6f1bf8d9c68736fc716ad520201a4c97d3cd47003
|
4
|
+
data.tar.gz: 62e27f180ddf0603f06352ebef55495314fec8fe8e095ca950ea9ee035d5d7f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43cc29791deeea09d3f4eefc64c150b545d6821f3e47e84089b999e0a8079e1992f2c69b536d9779e2f6a11c21fd0a2e09057a3eaa43cfb8cbb882bdf662de74
|
7
|
+
data.tar.gz: b4b72cb2da6d3a5871eceb7824654d53b57ca677d56aa21f89502d04882a4c1bc17e0b6002dbb6de3be81494ad99ec347ccb1ddd896765d611d44da7f68b65a1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/kjlite.rb
CHANGED
@@ -24,7 +24,7 @@ module KjLite
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def text()
|
27
|
-
@verse[/^\d+:\d+:\d+\s+(.*)/m,1].gsub(/[\r\n
|
27
|
+
@verse[/^\d+:\d+:\d+\s+(.*)/m,1].gsub(/[\r\n\s]+/,' ').rstrip
|
28
28
|
end
|
29
29
|
|
30
30
|
def title()
|
@@ -53,11 +53,15 @@ module KjLite
|
|
53
53
|
def verses(*list)
|
54
54
|
|
55
55
|
puts 'inside verses' if @debug
|
56
|
+
puts '@verses: ' + @verses.inspect if @debug
|
56
57
|
|
57
58
|
list = list.first.to_a if list.first.is_a? Range
|
58
59
|
|
59
60
|
if list.empty? then
|
60
|
-
return @verses.map.with_index
|
61
|
+
return @verses.map.with_index do |x,i|
|
62
|
+
#puts 'x: ' + x.inspect
|
63
|
+
Verse.new @book_name, @id, i+1, x, debug: @debug
|
64
|
+
end
|
61
65
|
elsif list.length < 2
|
62
66
|
Verse.new @book_name, @id, list.first, @verses[list.first.to_i-1]
|
63
67
|
else
|
@@ -129,7 +133,7 @@ module KjLite
|
|
129
133
|
|
130
134
|
attr_reader :to_h, :to_s, :booklist
|
131
135
|
|
132
|
-
def initialize(url='
|
136
|
+
def initialize(url='https://gutenberg.org/cache/epub/30/pg30.txt',
|
133
137
|
debug: false)
|
134
138
|
|
135
139
|
filename, @debug = 'kjbible.txt', debug
|
@@ -137,14 +141,14 @@ module KjLite
|
|
137
141
|
if File.exists?(filename) then
|
138
142
|
s = File.read(filename)
|
139
143
|
else
|
140
|
-
s = open(url).read
|
144
|
+
s = URI.open(url).read
|
141
145
|
File.write filename, s
|
142
146
|
end
|
143
147
|
|
144
148
|
s2 = s.split(/.*(?=^Book 01)/,3).last; 0
|
145
149
|
a = s2.split(/.*(?=^Book \d+)/); 0
|
146
150
|
|
147
|
-
h = a.inject({}) do |r,x|
|
151
|
+
@h = a.inject({}) do |r,x|
|
148
152
|
|
149
153
|
title, body = x.match(/^Book \d+\s+([^\r]+)\s+(.*)/m).captures
|
150
154
|
|
@@ -153,14 +157,16 @@ module KjLite
|
|
153
157
|
r.merge(title => a3[1..-1])
|
154
158
|
|
155
159
|
end
|
156
|
-
|
160
|
+
|
161
|
+
#puts '@h: ' + @h.keys.inspect
|
162
|
+
=begin
|
157
163
|
@h = h.group_by {|key, _| key[/\d*\s*(.*)/,1]}; 0
|
158
164
|
|
159
165
|
@h.each do |key, value|
|
160
166
|
@h[key] = value.length < 2 ? value.last.last : value.map(&:last)
|
161
167
|
end
|
162
|
-
|
163
|
-
@to_h, @to_s, @booklist = @h, s, h.keys
|
168
|
+
=end
|
169
|
+
@to_h, @to_s, @booklist = @h, s, @h.keys
|
164
170
|
|
165
171
|
end
|
166
172
|
|
@@ -171,17 +177,13 @@ module KjLite
|
|
171
177
|
index = ref.to_s[/^\d+$/] ? (ref.to_i - 1) : find_book(ref.downcase)
|
172
178
|
puts 'index: ' + index.inspect if @debug
|
173
179
|
title = @booklist[index]
|
174
|
-
r = @h[title.sub(/^\d+\s+/,'')]
|
180
|
+
#r = @h[title.sub(/^\d+\s+/,'')]
|
181
|
+
r = @h[title]
|
175
182
|
|
176
183
|
puts 'r: ' + r.class.inspect if @debug
|
177
184
|
|
178
|
-
|
179
|
-
|
180
|
-
else
|
181
|
-
i = ref[/\d+/].to_i - 1
|
182
|
-
a = r.map.with_index {|x,i| Book.new index+1, title, r[i], debug: @debug}
|
183
|
-
a[i]
|
184
|
-
end
|
185
|
+
Book.new index+1, title, r, debug: @debug
|
186
|
+
|
185
187
|
end
|
186
188
|
|
187
189
|
def inspect()
|
@@ -204,6 +206,8 @@ module KjLite
|
|
204
206
|
|
205
207
|
def find_book(ref)
|
206
208
|
|
209
|
+
puts 'find_book/ref: ' + ref.inspect if @debug
|
210
|
+
|
207
211
|
h = @booklist.inject({}) do |r,rawx|
|
208
212
|
|
209
213
|
x = rawx.downcase
|
@@ -215,20 +219,19 @@ module KjLite
|
|
215
219
|
NoVowels.compact(x.sub(/(\d)\s/,'\1')),
|
216
220
|
NoVowels.compact(x.sub(/(\d)\s/,'\1-')),
|
217
221
|
]
|
218
|
-
puts 'a3: ' + a3.inspect if @debug
|
222
|
+
#puts 'a3: ' + a3.inspect if @debug
|
219
223
|
a3b = a3.uniq.abbrev.keys.reject {|x| x[/^\s*\d+$/] or x.length < 2}
|
220
224
|
r.merge(rawx => a3b)
|
221
225
|
|
222
226
|
end
|
223
|
-
puts 'h: ' + h.inspect if @debug
|
227
|
+
#puts 'h: ' + h.inspect if @debug
|
224
228
|
r = h.find {|key, val| val.grep(/#{ref}/).any? }
|
225
229
|
r = h.find {|key, vl| vl.grep(/#{ref.sub(/\d+\s*/,'')}/).any? } unless r
|
226
|
-
puts '
|
227
|
-
@booklist.index r.first
|
230
|
+
puts '_r: ' + r.inspect if @debug
|
231
|
+
@booklist.index r.first if r
|
228
232
|
|
229
233
|
end
|
230
234
|
|
231
235
|
end
|
232
236
|
|
233
237
|
end
|
234
|
-
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kjlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,32 +10,33 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
13
|
+
MIIEljCCAv6gAwIBAgIBATANBgkqhkiG9w0BAQsFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTIyMDcxNDE2MjU0NFoXDTIzMDcxNDE2MjU0NFowSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoC
|
18
|
+
ggGBAL8RMmMCCcZQc/yAuYF7WwTixiT6gJVIwQAG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|
+
ToIWu8HKGZirK8lDNT1TnDAEfeieMeQE+ha3MycqPQjTUOffqd9jIKf8zMelIXXX
|
34
|
+
EDbY7W3a8ntMUSyX+3FD1k/JNGwgJ6hAIoEL1JklVBU0utqU+25IFkrwAzsGKzYX
|
35
|
+
wHsrBcLrEqKeQ4v6zBckiJcr+ibE19ycTKkwxjJtYMJBOA7VC62i1q132a+t6Co7
|
36
|
+
EALnBk6AgDlRDIbN+5DYzhfnTJ1Tjl8AktYuDKy5QnljJI1ywXdnUUQV4sbSUiIq
|
37
|
+
GLSnE26JTgh8Vx2YqZ7IisLxAR/yR2wdAG8=
|
37
38
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
39
|
+
date: 2022-10-31 00:00:00.000000000 Z
|
39
40
|
dependencies:
|
40
41
|
- !ruby/object:Gem::Dependency
|
41
42
|
name: novowels
|
@@ -58,7 +59,7 @@ dependencies:
|
|
58
59
|
- !ruby/object:Gem::Version
|
59
60
|
version: 0.1.3
|
60
61
|
description:
|
61
|
-
email:
|
62
|
+
email: digital.robertson@gmail.com
|
62
63
|
executables: []
|
63
64
|
extensions: []
|
64
65
|
extra_rdoc_files: []
|
@@ -83,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
84
|
- !ruby/object:Gem::Version
|
84
85
|
version: '0'
|
85
86
|
requirements: []
|
86
|
-
rubygems_version: 3.
|
87
|
+
rubygems_version: 3.3.7
|
87
88
|
signing_key:
|
88
89
|
specification_version: 4
|
89
90
|
summary: kjlist is a lightweight version of the kj gem for accessing the King James
|
metadata.gz.sig
CHANGED
Binary file
|