bibletools 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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/bibletools.rb +55 -6
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: 5085703f655b244826701beeba91b5bbfc535a8d34f2d4fbbc842c6229ced5fa
|
4
|
+
data.tar.gz: 27639f898a9c016fdbaf47cbaddeae392c93500145492ea0ba51f1a2ebc82e1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a70124fe758ee62e6874e6126db903c56eb0edf8bd35f5ea7a80dae1917cc30c225191dc6eec93f35ac1f63b77dbaef461f25398a5a0db90684ece938aa427c8
|
7
|
+
data.tar.gz: 861ed48ae15f6d7516d98fac70e76b2b2bc6633c90f56193b7ca4f5f8fafbeee07e12ba8adbef23cb57119ef7c0a0c9ff31e7ec49a91383f695c19955dbfc9fc
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/bibletools.rb
CHANGED
@@ -163,8 +163,8 @@ module BibleTools
|
|
163
163
|
@debug = debug
|
164
164
|
|
165
165
|
if bible_obj then
|
166
|
+
|
166
167
|
@doc = bible_obj.to_doc
|
167
|
-
@verses = @doc.root.xpath('chapter/verse')
|
168
168
|
@check = EnglishSpellcheck.new debug: false #verbose: false
|
169
169
|
|
170
170
|
if tts then
|
@@ -195,11 +195,11 @@ module BibleTools
|
|
195
195
|
|
196
196
|
h = a.group_by(&:first)
|
197
197
|
a2 = h.sort_by {|x, _| x.to_i}
|
198
|
-
|
198
|
+
@verses = a2.map do |chapter, verses|
|
199
199
|
[chapter, verses.sort_by {|_,x| x.to_i}]
|
200
200
|
end
|
201
201
|
|
202
|
-
[
|
202
|
+
[@verses, trail2]
|
203
203
|
end
|
204
204
|
|
205
205
|
# find the words associated with a given keyword
|
@@ -321,6 +321,52 @@ module BibleTools
|
|
321
321
|
|
322
322
|
end
|
323
323
|
|
324
|
+
def verses(level: nil, html: false, title: nil)
|
325
|
+
|
326
|
+
a = @verses.map {|_, body| body}.flatten(1)
|
327
|
+
a1 = level ? a.select {|c,v,t,l| l <= level} : a.map {|c,v,t,l| [c,v,t]}
|
328
|
+
a2 = a1.map {|c,v,t,l| [c,v,t]}.uniq
|
329
|
+
h = a2.group_by(&:first)
|
330
|
+
|
331
|
+
puts 'html: ' + html.inspect
|
332
|
+
return h unless html == true
|
333
|
+
|
334
|
+
doc = Rexle.new('<html/>')
|
335
|
+
|
336
|
+
|
337
|
+
head = Rexle::Element.new('head')
|
338
|
+
head.add(Rexle::Element.new('h1').add_text(title) ) if title
|
339
|
+
|
340
|
+
style = Rexle::Element.new('style')
|
341
|
+
style.add_text ' ins {font-size: 0.8em;padding: 0.8em;}'
|
342
|
+
head.add style
|
343
|
+
|
344
|
+
doc.root.add head
|
345
|
+
body = Rexle::Element.new('body')
|
346
|
+
|
347
|
+
h.each do |chptr, verses|
|
348
|
+
|
349
|
+
h2 = Rexle::Element.new('h2').add_text chptr
|
350
|
+
body.add h2
|
351
|
+
|
352
|
+
verses.each do |cno, vno, text|
|
353
|
+
|
354
|
+
ins = Rexle::Element.new('ins').add_text vno
|
355
|
+
para = Rexle::Element.new('p')
|
356
|
+
para.add ins
|
357
|
+
para.add_text text
|
358
|
+
body.add para
|
359
|
+
|
360
|
+
end
|
361
|
+
|
362
|
+
end
|
363
|
+
|
364
|
+
doc.root.add body
|
365
|
+
|
366
|
+
doc.root.xml pretty: true
|
367
|
+
|
368
|
+
end
|
369
|
+
|
324
370
|
private
|
325
371
|
|
326
372
|
def mine_words(r, trail, verses=[], level: 0)
|
@@ -329,21 +375,24 @@ module BibleTools
|
|
329
375
|
found = []
|
330
376
|
(i-=1; found = r.last[i][0].keys - trail) until found.any?
|
331
377
|
r2 = r.last[i][0].keys - trail
|
378
|
+
|
332
379
|
a3 = r2.map do |x|
|
380
|
+
|
333
381
|
_, doc_verse = assoc_r x, r.last[i][1]
|
334
382
|
chaptr_no = doc_verse.root.element('chapter').attributes[:no]
|
335
383
|
everse = doc_verse.root.element('chapter/verse')
|
336
384
|
verse_no = everse.attributes[:no]
|
385
|
+
|
337
386
|
[chaptr_no, verse_no, everse.text, level]
|
387
|
+
|
338
388
|
end.uniq
|
339
389
|
|
340
|
-
#a3b = a3.group_by {|x| x[0]}.map(&:last).flatten(1).sort_by {|x| x[0].to_i}
|
341
|
-
#a3b.length
|
342
|
-
|
343
390
|
puts 'verses: ' + verses.inspect if @debug
|
391
|
+
|
344
392
|
verses.concat a3
|
345
393
|
verses.uniq!
|
346
394
|
trail.concat r2
|
395
|
+
|
347
396
|
puts 'trail.length: ' + trail.length.inspect if @debug
|
348
397
|
puts 'verses.length: ' + verses.length.inspect if @debug
|
349
398
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibletools
|
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
|
- James Robertson
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
hIlyeyH9vsaJLam1TYsSqh3KUBmRCIvc3XELg2MAlggTrHuCjBPdYXqjIOFvO6HZ
|
37
37
|
Z1XDnMf4RhcEPF4AU3Q+Fefsw4qKRWH3YUw=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date: 2022-11-
|
39
|
+
date: 2022-11-06 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: nokorexi
|
metadata.gz.sig
CHANGED
Binary file
|