bible_ref 1.1.2 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/lib/bible_ref/canons.rb +3 -2
- data/lib/bible_ref/canons/all.rb +15 -0
- data/lib/bible_ref/languages.rb +3 -1
- data/lib/bible_ref/languages/base.rb +6 -6
- data/lib/bible_ref/languages/english.rb +3 -3
- data/lib/bible_ref/languages/latin.rb +79 -0
- data/lib/bible_ref/languages/portuguese.rb +1 -1
- data/lib/bible_ref/languages/romanian.rb +1 -1
- data/lib/bible_ref/parser.rb +13 -5
- data/lib/bible_ref/reference.rb +1 -1
- data/lib/bible_ref/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5b66f31665e878b3a71f4c334f43ed5a26c972f15989e8569fab62aa557df191
|
4
|
+
data.tar.gz: 9e7d5a746bf49b140963dfcc945eeaee58fcf68633828892447519841d656f5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 460cb9fc1df0ae490c46607ed010b21986d636dc63c2a5783ca3343589a58351570c15df9deca603a309108ca59ac74c70b89e994da1e45eec939f648fb2b27f
|
7
|
+
data.tar.gz: 88462cdbb3dc94dc66c1470455ea5b0de6605da4d1df45a2b1be761fc7ee2262aa8558173df036686f1f8bc2ab329995b7bf64e430bc411bae982591b3032154
|
data/README.md
CHANGED
data/lib/bible_ref/canons.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module BibleRef
|
2
|
+
module Canons
|
3
|
+
class All
|
4
|
+
def books
|
5
|
+
%w(
|
6
|
+
GEN EXO LEV NUM DEU JOS JDG RUT 1SA 2SA 1KI 2KI 1CH 2CH EZR NEH EST JOB
|
7
|
+
PSA PRO ECC SNG ISA JER LAM EZK DAN HOS JOL AMO OBA JON MIC NAM HAB ZEP HAG
|
8
|
+
ZEC MAL TOB JDT ESG WIS SIR BAR LJE S3Y SUS BEL 1MA 2MA 1ES MAN PS2 3MA 2ES
|
9
|
+
4MA MAT MRK LUK JHN ACT ROM 1CO 2CO GAL EPH PHP COL 1TH 2TH 1TI 2TI TIT PHM
|
10
|
+
HEB JAS 1PE 2PE 1JN 2JN 3JN JUD REV
|
11
|
+
)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/bible_ref/languages.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative 'languages/cherokee'
|
2
2
|
require_relative 'languages/english'
|
3
|
+
require_relative 'languages/latin'
|
3
4
|
require_relative 'languages/portuguese'
|
4
5
|
require_relative 'languages/romanian'
|
5
6
|
|
@@ -7,7 +8,8 @@ module BibleRef
|
|
7
8
|
LANGUAGES = {
|
8
9
|
'chr' => Languages::Cherokee,
|
9
10
|
'eng' => Languages::English,
|
11
|
+
'lat' => Languages::Latin,
|
10
12
|
'por' => Languages::Portuguese,
|
11
13
|
'ron' => Languages::Romanian
|
12
|
-
}
|
14
|
+
}.freeze
|
13
15
|
end
|
@@ -6,15 +6,15 @@ module BibleRef
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def book_id(book_name, canon)
|
9
|
-
book_name = replace_roman_numerals(book_name
|
9
|
+
book_name = replace_roman_numerals(book_name)
|
10
10
|
return book_name.upcase if books[book_name.upcase] # already normalized
|
11
11
|
canon.books.each do |book|
|
12
12
|
details = books[book]
|
13
13
|
next if details.nil?
|
14
14
|
if (match = details[:match])
|
15
|
-
return book if book_name =~ match
|
15
|
+
return book if book_name.downcase =~ match
|
16
16
|
else
|
17
|
-
return book if book_name == details[:name]
|
17
|
+
return book if book_name.downcase == details[:name].downcase
|
18
18
|
end
|
19
19
|
end
|
20
20
|
nil
|
@@ -26,9 +26,9 @@ module BibleRef
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def replace_roman_numerals(book)
|
29
|
-
book.sub!(/^iii /i, '3 ')
|
30
|
-
book.sub!(/^ii /i, '2 ')
|
31
|
-
book.sub!(/^i /i, '1 ')
|
29
|
+
book.sub!(/^iii |^III /i, '3 ')
|
30
|
+
book.sub!(/^ii |^II /i, '2 ')
|
31
|
+
book.sub!(/^i |^I /i, '1 ')
|
32
32
|
book
|
33
33
|
end
|
34
34
|
end
|
@@ -46,7 +46,7 @@ module BibleRef
|
|
46
46
|
'ZEC' => { match: /^zec/, name: 'Zechariah' },
|
47
47
|
'MAL' => { match: /^mal/, name: 'Malachi' },
|
48
48
|
'TOB' => { match: /^tob/, name: 'Tobit' },
|
49
|
-
'JDT' => { match: /^(
|
49
|
+
'JDT' => { match: /^(jth|jdth?|judith)/, name: 'Judith' },
|
50
50
|
'ESG' => { match: /^(est.*greek|esg)/, name: 'Esther (Greek)' },
|
51
51
|
'WIS' => { match: /^wis(dom)?/, name: 'Wisdom of Solomon' },
|
52
52
|
'SIR' => { match: /^sir/, name: 'Sirach' },
|
@@ -64,7 +64,7 @@ module BibleRef
|
|
64
64
|
'2ES' => { match: /^2 ?esd?/, name: '2 Esdras' },
|
65
65
|
'4MA' => { match: /^4 ?mac?/, name: '4 Maccabees' },
|
66
66
|
'MAT' => { match: /^mat/, name: 'Matthew' },
|
67
|
-
'MRK' => { match: /^ma?rk/,
|
67
|
+
'MRK' => { match: /^(ma?rk|mk)/, name: 'Mark' },
|
68
68
|
'LUK' => { match: /^lu?k/, name: 'Luke' },
|
69
69
|
'JHN' => { match: /^(john|jn|jhn)/, name: 'John' },
|
70
70
|
'ACT' => { match: /^act/, name: 'Acts' },
|
@@ -88,7 +88,7 @@ module BibleRef
|
|
88
88
|
'1JN' => { match: /^1 ?jo?h?n/, name: '1 John' },
|
89
89
|
'2JN' => { match: /^2 ?jo?h?n/, name: '2 John' },
|
90
90
|
'3JN' => { match: /^3 ?jo?h?n/, name: '3 John' },
|
91
|
-
'JUD' => { match: /^jud/,
|
91
|
+
'JUD' => { match: /^(jud$|jd$|jude$)/, name: 'Jude' },
|
92
92
|
'REV' => { match: /^re?v/, name: 'Revelation' }
|
93
93
|
}
|
94
94
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require_relative 'base'
|
3
|
+
|
4
|
+
module BibleRef
|
5
|
+
module Languages
|
6
|
+
class Latin < Base
|
7
|
+
def books
|
8
|
+
{
|
9
|
+
'GEN' => { name: 'Genesis' },
|
10
|
+
'EXO' => { name: 'Exodus' },
|
11
|
+
'LEV' => { name: 'Leviticus' },
|
12
|
+
'NUM' => { name: 'Numeri' },
|
13
|
+
'DEU' => { name: 'Deuteronomium' },
|
14
|
+
'JOS' => { name: 'Josue' },
|
15
|
+
'JDG' => { name: 'Judicum' },
|
16
|
+
'RUT' => { name: 'Ruth' },
|
17
|
+
'1SA' => { name: 'Regum I' },
|
18
|
+
'2SA' => { name: 'Regum II' },
|
19
|
+
'1KI' => { name: 'Regum III' },
|
20
|
+
'2KI' => { name: 'Regum IV' },
|
21
|
+
'1CH' => { name: 'Paralipomenon I' },
|
22
|
+
'2CH' => { name: 'Paralipomenon II' },
|
23
|
+
'EZR' => { name: 'Esdræ' },
|
24
|
+
'NEH' => { name: 'Nehemiæ' },
|
25
|
+
'EST' => { name: 'Tobiæ' },
|
26
|
+
'JOB' => { name: 'Job' },
|
27
|
+
'PSA' => { name: 'Psalmi' },
|
28
|
+
'PRO' => { name: 'Proverbia' },
|
29
|
+
'ECC' => { name: 'Ecclesiastes' },
|
30
|
+
'SNG' => { name: 'Canticum Canticorum' },
|
31
|
+
'ISA' => { name: 'Isaias' },
|
32
|
+
'JER' => { name: 'Jeremias' },
|
33
|
+
'LAM' => { name: 'Lamentationes' },
|
34
|
+
'EZK' => { name: 'Ezechiel' },
|
35
|
+
'DAN' => { name: 'Daniel' },
|
36
|
+
'HOS' => { name: 'Osee' },
|
37
|
+
'JOL' => { name: 'Joël' },
|
38
|
+
'AMO' => { name: 'Amos' },
|
39
|
+
'OBA' => { name: 'Abdias' },
|
40
|
+
'JON' => { name: 'Jonas' },
|
41
|
+
'MIC' => { name: 'Michæa' },
|
42
|
+
'NAM' => { name: 'Nahum' },
|
43
|
+
'HAB' => { name: 'Habacuc' },
|
44
|
+
'ZEP' => { name: 'Sophonias' },
|
45
|
+
'HAG' => { name: 'Aggæus' },
|
46
|
+
'ZEC' => { name: 'Zacharias' },
|
47
|
+
'MAL' => { name: 'Malachias' },
|
48
|
+
'MAT' => { name: 'Matthæus' },
|
49
|
+
'MRK' => { name: 'Marcus' },
|
50
|
+
'LUK' => { name: 'Lucas' },
|
51
|
+
'JHN' => { name: 'Joannes' },
|
52
|
+
'ACT' => { name: 'Actus Apostolorum' },
|
53
|
+
'ROM' => { name: 'ad Romanos' },
|
54
|
+
'1CO' => { name: 'ad Corinthios I' },
|
55
|
+
'2CO' => { name: 'ad Corinthios II' },
|
56
|
+
'GAL' => { name: 'ad Galatas' },
|
57
|
+
'EPH' => { name: 'ad Ephesios' },
|
58
|
+
'PHP' => { name: 'ad Philippenses' },
|
59
|
+
'COL' => { name: 'ad Colossenses' },
|
60
|
+
'1TH' => { name: 'ad Thessalonicenses I' },
|
61
|
+
'2TH' => { name: 'ad Thessalonicenses II' },
|
62
|
+
'1TI' => { name: 'ad Timotheum I' },
|
63
|
+
'2TI' => { name: 'ad Timotheum II' },
|
64
|
+
'TIT' => { name: 'ad Titum' },
|
65
|
+
'PHM' => { name: 'ad Philemonem' },
|
66
|
+
'HEB' => { name: 'ad Hebræos' },
|
67
|
+
'JAS' => { name: 'Jacobi' },
|
68
|
+
'1PE' => { name: 'Petri I' },
|
69
|
+
'2PE' => { name: 'Petri II' },
|
70
|
+
'1JN' => { name: 'Joannis I' },
|
71
|
+
'2JN' => { name: 'Joannis II' },
|
72
|
+
'3JN' => { name: 'Joannis III' },
|
73
|
+
'JUD' => { name: 'Judæ' },
|
74
|
+
'REV' => { name: 'Apocalypsis' }
|
75
|
+
}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -46,7 +46,7 @@ module BibleRef
|
|
46
46
|
'ZEC' => { match: /^zac/, name: 'Zacarias' },
|
47
47
|
'MAL' => { match: /^mal/, name: 'Malaquias' },
|
48
48
|
'MAT' => { match: /^mat/, name: 'Mateus' },
|
49
|
-
'MRK' => { match: /^mar/,
|
49
|
+
'MRK' => { match: /^(mar|mk)/, name: 'Marcos' },
|
50
50
|
'LUK' => { match: /^lu/, name: 'Lucas' },
|
51
51
|
'JHN' => { match: /^jo/, name: 'João' },
|
52
52
|
'ACT' => { match: /^at/, name: 'Atos' },
|
@@ -46,7 +46,7 @@ module BibleRef
|
|
46
46
|
'ZEC' => { match: /^za/, name: 'Zaharia' },
|
47
47
|
'MAL' => { match: /^mal/, name: 'Maleahi' },
|
48
48
|
'MAT' => { match: /^mat/, name: 'Matei' },
|
49
|
-
'MRK' => { match: /^mar/,
|
49
|
+
'MRK' => { match: /^(mar|mk)/, name: 'Marcu' },
|
50
50
|
'LUK' => { match: /^lu/, name: 'Luca' },
|
51
51
|
'JHN' => { match: /^io/, name: 'Ioan' },
|
52
52
|
'ACT' => { match: /^fa/, name: 'Faptele apostolilor' },
|
data/lib/bible_ref/parser.rb
CHANGED
@@ -4,14 +4,22 @@ module BibleRef
|
|
4
4
|
class Parser < Parslet::Parser
|
5
5
|
rule(:refs) do
|
6
6
|
(
|
7
|
-
|
8
|
-
(
|
9
|
-
separator >>
|
10
|
-
(ref_range | verse_range | ref | verse)
|
11
|
-
).repeat
|
7
|
+
chapter_range | chapter_and_verse_range
|
12
8
|
).as(:refs)
|
13
9
|
end
|
14
10
|
|
11
|
+
rule(:chapter_range) do
|
12
|
+
chapter >> (separator >> chapter).repeat
|
13
|
+
end
|
14
|
+
|
15
|
+
rule(:chapter_and_verse_range) do
|
16
|
+
(ref_range | ref | chapter) >>
|
17
|
+
(
|
18
|
+
separator >>
|
19
|
+
(ref_range | verse_range | ref | verse)
|
20
|
+
).repeat
|
21
|
+
end
|
22
|
+
|
15
23
|
rule(:ref_range) { (ref.as(:from) >> str("-") >> (ref | verse).as(:to)).as(:range) }
|
16
24
|
rule(:verse_range) { (verse.as(:from) >> str("-") >> verse.as(:to)).as(:range) }
|
17
25
|
|
data/lib/bible_ref/reference.rb
CHANGED
@@ -7,7 +7,7 @@ module BibleRef
|
|
7
7
|
attr_reader :book, :reference, :language, :canon
|
8
8
|
|
9
9
|
# Create a new Reference instance by passing in the user-supplied bible reference as a string.
|
10
|
-
def initialize(reference, language: 'eng', canon: '
|
10
|
+
def initialize(reference, language: 'eng', canon: 'all')
|
11
11
|
@reference = reference
|
12
12
|
@details = parse
|
13
13
|
@language = language.respond_to?(:book_id) ? language : LANGUAGES.fetch(language.to_s).new
|
data/lib/bible_ref/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bible_ref
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Morgan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
@@ -62,11 +62,13 @@ files:
|
|
62
62
|
- README.md
|
63
63
|
- lib/bible_ref.rb
|
64
64
|
- lib/bible_ref/canons.rb
|
65
|
+
- lib/bible_ref/canons/all.rb
|
65
66
|
- lib/bible_ref/canons/protestant.rb
|
66
67
|
- lib/bible_ref/languages.rb
|
67
68
|
- lib/bible_ref/languages/base.rb
|
68
69
|
- lib/bible_ref/languages/cherokee.rb
|
69
70
|
- lib/bible_ref/languages/english.rb
|
71
|
+
- lib/bible_ref/languages/latin.rb
|
70
72
|
- lib/bible_ref/languages/portuguese.rb
|
71
73
|
- lib/bible_ref/languages/romanian.rb
|
72
74
|
- lib/bible_ref/parser.rb
|
@@ -76,7 +78,7 @@ homepage: https://github.com/seven1m/bible_ref
|
|
76
78
|
licenses:
|
77
79
|
- MIT
|
78
80
|
metadata: {}
|
79
|
-
post_install_message:
|
81
|
+
post_install_message:
|
80
82
|
rdoc_options: []
|
81
83
|
require_paths:
|
82
84
|
- lib
|
@@ -91,9 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
93
|
- !ruby/object:Gem::Version
|
92
94
|
version: '0'
|
93
95
|
requirements: []
|
94
|
-
|
95
|
-
|
96
|
-
signing_key:
|
96
|
+
rubygems_version: 3.1.2
|
97
|
+
signing_key:
|
97
98
|
specification_version: 4
|
98
99
|
summary: Bible reference parser
|
99
100
|
test_files: []
|