bible_parser 1.1.1 → 1.1.3
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/README.md +1 -1
- data/lib/bible_parser/parsers/osis/document.rb +31 -4
- data/lib/bible_parser/parsers/usfx/document.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2589fc1c1a0faff54fd9550a3c474623d74ad32f4cdffe70815ff744a9696a77
|
|
4
|
+
data.tar.gz: 070ed35e7e8f41c11f0667892456b4038877ff815a8e09345df8d180a04f4797
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6d140484f8e1a989205775edd2fbd04cc5f54d8682ce84925331e8b7e219be65278e2e7b174d03d746910f34a2bfb276331aa9061f968011993404d2cd69cb0
|
|
7
|
+
data.tar.gz: d2ef4c8130bbaf1d38892666210c8286c82b0608ee48dc1e506f25080d8649c5c3c1f60611f04f640caa5f0e87c35f5bb82c2d0dd30341a431637973e5d072fd
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BibleParser
|
|
2
2
|
|
|
3
|
-
[](https://github.com/seven1m/bible_parser/actions/workflows/specs.yml)
|
|
4
4
|
|
|
5
5
|
This is a Ruby library for parsing different bible XML formats.
|
|
6
6
|
|
|
@@ -21,6 +21,8 @@ class BibleParser
|
|
|
21
21
|
when 'verse'
|
|
22
22
|
end_verse if @mode == 'verse'
|
|
23
23
|
start_verse(attributes)
|
|
24
|
+
when 'note'
|
|
25
|
+
start_footnote(attributes)
|
|
24
26
|
end
|
|
25
27
|
end
|
|
26
28
|
|
|
@@ -31,6 +33,12 @@ class BibleParser
|
|
|
31
33
|
end_book
|
|
32
34
|
@book_id = nil
|
|
33
35
|
end
|
|
36
|
+
when 'verse'
|
|
37
|
+
end_verse if @mode == 'verse' && @wrapping_verse
|
|
38
|
+
when 'chapter'
|
|
39
|
+
end_chapter if @wrapping_chapter
|
|
40
|
+
when 'note'
|
|
41
|
+
@mode = 'verse'
|
|
34
42
|
end
|
|
35
43
|
end
|
|
36
44
|
|
|
@@ -41,11 +49,10 @@ class BibleParser
|
|
|
41
49
|
@book_num += 1
|
|
42
50
|
@book_id = BOOK_IDS[id] || id.upcase[0..2]
|
|
43
51
|
@mode = 'book'
|
|
44
|
-
@book_title =
|
|
52
|
+
@book_title = id
|
|
45
53
|
end
|
|
46
54
|
|
|
47
55
|
def set_book_title(attributes)
|
|
48
|
-
return if @book_title
|
|
49
56
|
attributes = Hash[attributes]
|
|
50
57
|
return unless attributes['type'] == 'main'
|
|
51
58
|
@book_title = attributes['short']
|
|
@@ -64,6 +71,10 @@ class BibleParser
|
|
|
64
71
|
attributes = Hash[attributes]
|
|
65
72
|
if attributes['sID']
|
|
66
73
|
@chapter = attributes['n'].to_i
|
|
74
|
+
@wrapping_chapter = false
|
|
75
|
+
elsif attributes['osisID']
|
|
76
|
+
@chapter = attributes['osisID'].split('.').last.to_i
|
|
77
|
+
@wrapping_chapter = true
|
|
67
78
|
else
|
|
68
79
|
end_chapter
|
|
69
80
|
end
|
|
@@ -71,12 +82,28 @@ class BibleParser
|
|
|
71
82
|
|
|
72
83
|
def start_verse(attributes)
|
|
73
84
|
attributes = Hash[attributes]
|
|
74
|
-
|
|
75
|
-
|
|
85
|
+
if attributes['sID']
|
|
86
|
+
@verse = attributes['n'].to_i
|
|
87
|
+
@wrapping_verse = false
|
|
88
|
+
elsif attributes['osisID']
|
|
89
|
+
@verse = attributes['osisID'].split('.').last.to_i
|
|
90
|
+
@wrapping_verse = true
|
|
91
|
+
else
|
|
92
|
+
return
|
|
93
|
+
end
|
|
76
94
|
@text = ''
|
|
77
95
|
@mode = 'verse'
|
|
78
96
|
end
|
|
79
97
|
|
|
98
|
+
# Properly parse footnotes out of the text that shows up within a verse
|
|
99
|
+
def start_footnote(attributes)
|
|
100
|
+
@mode = 'note'
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def end_footnote(attributes)
|
|
104
|
+
@mode = 'verse'
|
|
105
|
+
end
|
|
106
|
+
|
|
80
107
|
def characters(string)
|
|
81
108
|
case @mode
|
|
82
109
|
when 'verse'
|
|
@@ -10,10 +10,12 @@ class BibleParser
|
|
|
10
10
|
def start_element(name, attributes)
|
|
11
11
|
case name
|
|
12
12
|
when 'book'
|
|
13
|
+
end_verse if @mode == 'verse'
|
|
13
14
|
start_book(attributes)
|
|
14
15
|
when 'h'
|
|
15
16
|
start_book_title(attributes)
|
|
16
17
|
when 'c'
|
|
18
|
+
end_verse if @mode == 'verse'
|
|
17
19
|
start_chapter(attributes)
|
|
18
20
|
when 'v'
|
|
19
21
|
end_verse if @mode == 'verse'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bible_parser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tim Morgan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
97
97
|
- !ruby/object:Gem::Version
|
|
98
98
|
version: '0'
|
|
99
99
|
requirements: []
|
|
100
|
-
rubygems_version: 3.0.3
|
|
100
|
+
rubygems_version: 3.0.3.1
|
|
101
101
|
signing_key:
|
|
102
102
|
specification_version: 4
|
|
103
103
|
summary: Library for parsing the bible in various formats
|