scripref 1.2.2 → 2.1.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
- data/Changelog +13 -0
- data/LICENSE +1 -1
- data/Rakefile +3 -0
- data/lib/scripref/basic_methods.rb +11 -5
- data/lib/scripref/bookname.rb +87 -9
- data/lib/scripref/bookorder.rb +36 -8
- data/lib/scripref/english.rb +76 -29
- data/lib/scripref/formatter.rb +7 -7
- data/lib/scripref/german.rb +76 -28
- data/lib/scripref/parser.rb +55 -54
- data/lib/scripref/passage.rb +4 -57
- data/lib/scripref/processor.rb +2 -0
- data/lib/scripref/sorter.rb +85 -0
- data/lib/scripref.rb +2 -1
- data/test/test_bookname.rb +13 -5
- data/test/test_english.rb +13 -13
- data/test/test_formatter.rb +3 -8
- data/test/test_german.rb +12 -12
- data/test/test_parser.rb +11 -0
- data/test/test_processor.rb +2 -2
- data/test/test_sorter.rb +88 -0
- metadata +3 -2
- data/test/test_passage.rb +0 -91
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e8a5707b59a787a2c9d153d5664dc7089962afb7f301f381d340a54aa382fe2
|
|
4
|
+
data.tar.gz: 1b443da4486f615355a7eb98906228a6be744c1470396e731cb30c4ad4774189
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91c1e585d9e956434b4806e227bd8bbc5dc1eaf1ca6f101966175bcedcdc3d4b071614c3b9e78e17ae3abc5437decc5b8e5d8978ee63a93247b923e255e71dad
|
|
7
|
+
data.tar.gz: 3715eee536614b2f359bd3e0ca5bf40e0d32d5d113881e1351002d91535829aa374f2115ac6f69b35e543e87e794b80fe826882fe40b41deb41cd0efd68882e4
|
data/Changelog
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
2.1.0
|
|
2
|
+
Implement correct sorting for passages with addons.
|
|
3
|
+
|
|
4
|
+
2.0.0
|
|
5
|
+
Major release with following breaking changes:
|
|
6
|
+
Rewrite Bookorder and Bookname and adapt Formatter#format accordingly.
|
|
7
|
+
Remove Comparable mixin and depending methods from Passage and implement
|
|
8
|
+
Sorter instead.
|
|
9
|
+
Rename all osis_*_id names to book_id.
|
|
10
|
+
Rename OSIS_BOOK_ID_TO_BOOK_NAME -> BOOKNAMES_HASH
|
|
11
|
+
|
|
12
|
+
Further: Implement a lot of internal optimizations.
|
|
13
|
+
|
|
1
14
|
1.2.2
|
|
2
15
|
Extend German abbreviations.
|
|
3
16
|
|
data/LICENSE
CHANGED
data/Rakefile
CHANGED
|
@@ -18,17 +18,23 @@ module Scripref
|
|
|
18
18
|
NUMBER_RE
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
# Regular expression to match a book
|
|
21
|
+
# Regular expression to match a book
|
|
22
22
|
def book_re
|
|
23
23
|
return @book_re if @book_re
|
|
24
|
-
books_res_as_strings =
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
books_res_as_strings = []
|
|
25
|
+
each_bookname do |bn|
|
|
26
|
+
bn.each_name do |n|
|
|
27
|
+
books_res_as_strings << (n.gsub(/([^\dA-Z])/, '\1?').gsub('.', '\.'))
|
|
27
28
|
end
|
|
28
|
-
end
|
|
29
|
+
end
|
|
29
30
|
@book_re = Regexp.compile(books_res_as_strings.map {|s| '(\b' << s << '\b\.?\s*)' }.join('|'), nil)
|
|
30
31
|
end
|
|
31
32
|
|
|
33
|
+
# Enumerator over booknames
|
|
34
|
+
def each_bookname &blk
|
|
35
|
+
booknames_hash.each_value(&blk)
|
|
36
|
+
end
|
|
37
|
+
|
|
32
38
|
end
|
|
33
39
|
|
|
34
40
|
end
|
data/lib/scripref/bookname.rb
CHANGED
|
@@ -5,28 +5,106 @@ module Scripref
|
|
|
5
5
|
|
|
6
6
|
class Bookname
|
|
7
7
|
|
|
8
|
-
attr_reader :
|
|
8
|
+
attr_reader :book_id
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
# @param book_id OSID-ID of the book
|
|
11
|
+
# @param name full name of the book
|
|
12
|
+
# @param abbrevs possible abbreviations for the book
|
|
13
|
+
# @param alternatives further Bookname instances with alternative names and abbreviations for book
|
|
14
|
+
def initialize book_id:, name:, abbrevs: [], alternatives: []
|
|
15
|
+
@book_id = book_id
|
|
16
|
+
@name = name
|
|
13
17
|
@abbrevs = Array(abbrevs)
|
|
18
|
+
@alternatives = Array(alternatives)
|
|
14
19
|
end
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
# Format the bookname (full name or abbreviation)
|
|
22
|
+
# @param abbrev_level if 0 full name, if >0 an abbreviation
|
|
23
|
+
def format abbrev_level: 0
|
|
24
|
+
case
|
|
25
|
+
when abbrev_level == 0
|
|
26
|
+
@name
|
|
27
|
+
when abbrev_level > 0
|
|
28
|
+
@abbrevs[abbrev_level - 1] || @abbrevs[-1] || @name
|
|
29
|
+
else
|
|
30
|
+
fail ArgumentError, 'negative values for abbrev_level are not allowed'
|
|
31
|
+
end
|
|
18
32
|
end
|
|
19
33
|
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
# Enumerator over all names (name and name of alternatives)
|
|
35
|
+
def each_name
|
|
36
|
+
if block_given?
|
|
37
|
+
yield @name
|
|
38
|
+
@alternatives.each do |bn|
|
|
39
|
+
bn.each_name do |alt_name|
|
|
40
|
+
yield alt_name
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
else
|
|
44
|
+
enum_for :each_name
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Enumerator over all names and abbreviations (including alternatives)
|
|
49
|
+
def each_string
|
|
50
|
+
if block_given?
|
|
51
|
+
yield @name
|
|
52
|
+
@abbrevs.each do |a|
|
|
53
|
+
yield a
|
|
54
|
+
end
|
|
55
|
+
@alternatives.each do |bn|
|
|
56
|
+
bn.each_string do |s|
|
|
57
|
+
yield s
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
else
|
|
61
|
+
enum_for :each_string
|
|
62
|
+
end
|
|
22
63
|
end
|
|
23
64
|
|
|
24
65
|
def to_s
|
|
25
|
-
@
|
|
66
|
+
@name
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Convert the instance to an equivalent string representation
|
|
70
|
+
def dump
|
|
71
|
+
s = Kernel.format('%s: %s', @book_id, [@name, @abbrevs].flatten.join('|'))
|
|
72
|
+
[s, @alternatives.map(&:dump).map {|s| s.sub(/^.+?: /, '')}].flatten.join(', ')
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def inspect
|
|
76
|
+
Kernel.format('#<%s %s>', self.class, dump.inspect)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def == other
|
|
80
|
+
other.respond_to?(:dump) && dump == other.dump
|
|
26
81
|
end
|
|
27
82
|
|
|
28
83
|
alias to_str to_s
|
|
29
84
|
|
|
85
|
+
class << self
|
|
86
|
+
|
|
87
|
+
# Helper method to create Bookname instances from a String
|
|
88
|
+
# @param s string to parse
|
|
89
|
+
# format: [book_id]: [full name]|[abbrev1]|[abbrev2]|...(, [alternative name]|[abbrev1],...]*
|
|
90
|
+
# @example Format
|
|
91
|
+
# Zeph: Zefanja|Zef, Zephanja|Zeph
|
|
92
|
+
# @example Code equivalent
|
|
93
|
+
# Bookname.new(book_id: :Zeph, name: 'Zefanja', abbrevs: ['Zef'], alternatives: Bookname.new(book_id: :Zeph, name: 'Zephanja', abbrevs: ['Zeph']))
|
|
94
|
+
def parse s
|
|
95
|
+
book_id, rest = s.split(/:\s*/).map(&:strip)
|
|
96
|
+
book_id = book_id.to_sym
|
|
97
|
+
org, *alternatives = rest.split(/,\s*/).map(&:strip)
|
|
98
|
+
name, *abbrevs = org.split('|').map(&:strip)
|
|
99
|
+
alternatives.map! do |s|
|
|
100
|
+
n, *a = s.split('|').map(&:strip)
|
|
101
|
+
Bookname.new(book_id: book_id, name: n, abbrevs: a)
|
|
102
|
+
end
|
|
103
|
+
Bookname.new(book_id: book_id, name: name, abbrevs: abbrevs, alternatives: alternatives)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
end
|
|
107
|
+
|
|
30
108
|
end
|
|
31
109
|
|
|
32
110
|
end
|
data/lib/scripref/bookorder.rb
CHANGED
|
@@ -3,18 +3,46 @@
|
|
|
3
3
|
|
|
4
4
|
module Scripref
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Module to handle differend orderings of bible books using standardized IDs
|
|
7
7
|
# (see https://wiki.crosswire.org/OSIS_Book_Abbreviations)
|
|
8
8
|
module Bookorder
|
|
9
9
|
|
|
10
10
|
# Canonical order (the default order without any apocryphal books)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
module Canonical
|
|
12
|
+
|
|
13
|
+
BOOK_IDS = %i[
|
|
14
|
+
Gen Exod Lev Num Deut Josh Judg Ruth 1Sam 2Sam 1Kgs 2Kgs 1Chr 2Chr Ezra
|
|
15
|
+
Neh Esth Job Ps Prov Eccl Song Isa Jer Lam Ezek Dan Hos Joel Amos Obad
|
|
16
|
+
Jonah Mic Nah Hab Zeph Hag Zech Mal Matt Mark Luke John Acts Rom 1Cor
|
|
17
|
+
2Cor Gal Eph Phil Col 1Thess 2Thess 1Tim 2Tim Titus Phlm Heb Jas 1Pet
|
|
18
|
+
2Pet 1John 2John 3John Jude Rev
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
def book2num book_id
|
|
22
|
+
@book2num ||= BOOK_IDS.zip(1..).to_h
|
|
23
|
+
@book2num[book_id]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Luther order (without any apocryphal books)
|
|
29
|
+
module Luther
|
|
30
|
+
|
|
31
|
+
BOOK_IDS = %i[
|
|
32
|
+
Gen Exod Lev Num Deut Josh Judg Ruth 1Sam 2Sam 1Kgs 2Kgs 1Chr 2Chr Ezra
|
|
33
|
+
Neh Esth Job Ps Prov Eccl Song Isa Jer Lam Ezek Dan Hos Joel Amos Obad
|
|
34
|
+
Jonah Mic Nah Hab Zeph Hag Zech Mal Matt Mark Luke John Acts Rom 1Cor
|
|
35
|
+
2Cor Gal Eph Phil Col 1Thess 2Thess 1Tim 2Tim Titus Phlm 1Pet 2Pet 1John
|
|
36
|
+
2John 3John Heb Jas Jude Rev
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
def book2num book_id
|
|
40
|
+
@book2num ||= BOOK_IDS.zip(1..).to_h
|
|
41
|
+
@book2num[book_id]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
|
|
18
46
|
end
|
|
19
47
|
|
|
20
48
|
end
|
data/lib/scripref/english.rb
CHANGED
|
@@ -8,34 +8,81 @@ module Scripref
|
|
|
8
8
|
# Mixin for parsing references in English.
|
|
9
9
|
module English
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
Genesis
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
1
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
booknames = <<-END
|
|
12
|
+
Gen: Genesis|Gen
|
|
13
|
+
Exod: Exodus|Ex
|
|
14
|
+
Lev: Leviticus|Lev
|
|
15
|
+
Num: Numbers|Num
|
|
16
|
+
Deut: Deuteronomy|Deut
|
|
17
|
+
Josh: Joshua|Josh
|
|
18
|
+
Judg: Judges|Judg
|
|
19
|
+
Ruth: Ruth|Rth
|
|
20
|
+
1Sam: 1 Samuel|1 Sam
|
|
21
|
+
2Sam: 2 Samuel|2 Sam
|
|
22
|
+
1Kgs: 1 Kings|1 Kgs
|
|
23
|
+
2Kgs: 2 Kings|2 Kgs
|
|
24
|
+
1Chr: 1 Chronicles|1 Chron
|
|
25
|
+
2Chr: 2 Chronicles|2 Chron
|
|
26
|
+
Ezra: Ezra|Ezr
|
|
27
|
+
Neh: Nehemiah|Neh
|
|
28
|
+
Esth: Esther|Esth
|
|
29
|
+
Job: Job|Job
|
|
30
|
+
Ps: Psalms|Ps
|
|
31
|
+
Prov: Proverbs|Prov
|
|
32
|
+
Eccl: Ecclesiastes|Eccles
|
|
33
|
+
Song: Song of Songs|Song
|
|
34
|
+
Isa: Isaiah|Isa
|
|
35
|
+
Jer: Jeremiah|Jer
|
|
36
|
+
Lam: Lamentations|Lam
|
|
37
|
+
Ezek: Ezekiel|Ezek
|
|
38
|
+
Dan: Daniel|Dan
|
|
39
|
+
Hos: Hosea|Hos
|
|
40
|
+
Joel: Joel|Joel
|
|
41
|
+
Amos: Amos|Am
|
|
42
|
+
Obad: Obadiah|Obad
|
|
43
|
+
Jonah: Jonah|Jon
|
|
44
|
+
Mic: Micah|Mic
|
|
45
|
+
Nah: Nahum|Nah
|
|
46
|
+
Hab: Habakkuk|Hab
|
|
47
|
+
Zeph: Zephaniah|Zeph
|
|
48
|
+
Hag: Haggai|Hag
|
|
49
|
+
Zech: Zechariah|Zech
|
|
50
|
+
Mal: Malachi|Mal
|
|
51
|
+
Matt: Matthew|Matt
|
|
52
|
+
Mark: Mark|Mrk
|
|
53
|
+
Luke: Luke|Luk
|
|
54
|
+
John: John|John
|
|
55
|
+
Acts: Acts|Acts
|
|
56
|
+
Rom: Romans|Rom
|
|
57
|
+
1Cor: 1 Corinthians|1 Cor
|
|
58
|
+
2Cor: 2 Corinthians|2 Cor
|
|
59
|
+
Gal: Galatians|Gal
|
|
60
|
+
Eph: Ephesians|Eph
|
|
61
|
+
Phil: Philippians|Phil
|
|
62
|
+
Col: Colossians|Col
|
|
63
|
+
1Thess: 1 Thessalonians|1 Thess
|
|
64
|
+
2Thess: 2 Thessalonians|2 Thess
|
|
65
|
+
1Tim: 1 Timothy|1 Tim
|
|
66
|
+
2Tim: 2 Timothy|2 Tim
|
|
67
|
+
Titus: Titus|Tit
|
|
68
|
+
Phlm: Philemon|Philem
|
|
69
|
+
Heb: Hebrews|Heb
|
|
70
|
+
Jas: James|Jas
|
|
71
|
+
1Pet: 1 Peter|1 Pet
|
|
72
|
+
2Pet: 2 Peter|2 Pet
|
|
73
|
+
1John: 1 John|1 Joh
|
|
74
|
+
2John: 2 John|2 Joh
|
|
75
|
+
3John: 3 John|3 Joh
|
|
76
|
+
Jude: Jude|Jud
|
|
77
|
+
Rev: Revelation|Rev
|
|
23
78
|
END
|
|
24
79
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
1 Joh, 2 Joh, 3 Joh, Jud, Rev
|
|
32
|
-
END
|
|
33
|
-
|
|
34
|
-
# Array of book names.
|
|
35
|
-
BOOK_NAMES = Bookorder::CANONICAL.zip(book_names, book_abbrevs).map {|osis_book_id, names, abbrevs| Bookname.new(osis_id: osis_book_id, names: names, abbrevs: abbrevs)}
|
|
36
|
-
|
|
37
|
-
# Map of OSIS book ID to instance of Bookname
|
|
38
|
-
OSIS_BOOK_ID_TO_BOOK_NAME = Bookorder::CANONICAL.zip(BOOK_NAMES).map {|id, n| [id, n]}.to_h
|
|
80
|
+
# Mapping of OSIS book ID to instance of Bookname
|
|
81
|
+
BOOKNAMES_HASH = {}
|
|
82
|
+
booknames.each_line do |l|
|
|
83
|
+
bn = Bookname.parse(l)
|
|
84
|
+
BOOKNAMES_HASH[bn.book_id] = bn
|
|
85
|
+
end
|
|
39
86
|
|
|
40
87
|
# Separator between chapter and verse.
|
|
41
88
|
CV_SEPARATOR = ':'
|
|
@@ -77,9 +124,9 @@ module Scripref
|
|
|
77
124
|
POSTFIX_MORE_FOLLOWING_VERSES_RE = /ff\b\s*/o
|
|
78
125
|
|
|
79
126
|
# Check if book has only one chapter
|
|
80
|
-
# @param
|
|
81
|
-
def book_has_only_one_chapter?
|
|
82
|
-
%i[Obad Phlm 2John 3John Jude].include?(
|
|
127
|
+
# @param book_id OSIS-ID of the book
|
|
128
|
+
def book_has_only_one_chapter? book_id
|
|
129
|
+
%i[Obad Phlm 2John 3John Jude].include?(book_id)
|
|
83
130
|
end
|
|
84
131
|
|
|
85
132
|
# Regular expression to match punctuation marks
|
data/lib/scripref/formatter.rb
CHANGED
|
@@ -5,14 +5,14 @@ module Scripref
|
|
|
5
5
|
|
|
6
6
|
class Formatter
|
|
7
7
|
|
|
8
|
-
attr_accessor :
|
|
8
|
+
attr_accessor :abbrev_level, :cv_separator, :hyphen_separator, :pass_separator
|
|
9
9
|
|
|
10
10
|
# @param mods one or more modules to include
|
|
11
|
-
# @param
|
|
12
|
-
def initialize *mods,
|
|
11
|
+
# @param abbrev_level if 0 full name, if >0 an abbreviation
|
|
12
|
+
def initialize *mods, abbrev_level: 0
|
|
13
13
|
@mods = mods
|
|
14
14
|
mods.each {|m| extend m}
|
|
15
|
-
@
|
|
15
|
+
@abbrev_level = abbrev_level
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# Formats a reference (array of passages and maybe separators)
|
|
@@ -28,9 +28,9 @@ module Scripref
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# Formats a book
|
|
31
|
-
# @param
|
|
32
|
-
def format_book
|
|
33
|
-
|
|
31
|
+
# @param book_id OSIS-ID for book
|
|
32
|
+
def format_book book_id
|
|
33
|
+
booknames_hash[book_id].format(abbrev_level: abbrev_level)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Formats a chapter
|
data/lib/scripref/german.rb
CHANGED
|
@@ -8,33 +8,81 @@ module Scripref
|
|
|
8
8
|
# Mixin for parsing references in German.
|
|
9
9
|
module German
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
1. Mose
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
booknames = <<-END
|
|
12
|
+
Gen: 1. Mose|1. Mos|1Mo|1M
|
|
13
|
+
Exod: 2. Mose|2. Mos|2Mo|2M
|
|
14
|
+
Lev: 3. Mose|3. Mos|3Mo|3M
|
|
15
|
+
Num: 4. Mose|4. Mos|4Mo|4M
|
|
16
|
+
Deut: 5. Mose|5. Mos|5Mo|5M
|
|
17
|
+
Josh: Josua|Jos
|
|
18
|
+
Judg: Richter|Ri
|
|
19
|
+
Ruth: Ruth|Ruth|Rt
|
|
20
|
+
1Sam: 1. Samuel|1. Sam|1Sam|1Sm
|
|
21
|
+
2Sam: 2. Samuel|2. Sam|2Sam|2Sm
|
|
22
|
+
1Kgs: 1. Könige|1. Kön|1Kön|1Kö
|
|
23
|
+
2Kgs: 2. Könige|2. Kön|2Kön|2Kö
|
|
24
|
+
1Chr: 1. Chronika|1. Chr|1Chr|1Ch
|
|
25
|
+
2Chr: 2. Chronika|2. Chr|2Chr|2Ch
|
|
26
|
+
Ezra: Esra|Esr
|
|
27
|
+
Neh: Nehemia|Neh
|
|
28
|
+
Esth: Esther|Est
|
|
29
|
+
Job: Hiob|Hi
|
|
30
|
+
Ps: Psalm|Ps, Psalmen
|
|
31
|
+
Prov: Sprüche|Spr
|
|
32
|
+
Eccl: Prediger|Pred
|
|
33
|
+
Song: Hohelied|Hohel|Hoh|Hl
|
|
34
|
+
Isa: Jesaja|Jes
|
|
35
|
+
Jer: Jeremia|Jer
|
|
36
|
+
Lam: Klagelieder|Klag
|
|
37
|
+
Ezek: Hesekiel|Hes
|
|
38
|
+
Dan: Daniel|Dan
|
|
39
|
+
Hos: Hosea|Hos
|
|
40
|
+
Joel: Joel|Joel
|
|
41
|
+
Amos: Amos|Amos|Am
|
|
42
|
+
Obad: Obadja|Obad|Ob
|
|
43
|
+
Jonah: Jona|Jona|Jon
|
|
44
|
+
Mic: Micha|Mich|Mi
|
|
45
|
+
Nah: Nahum|Nah
|
|
46
|
+
Hab: Habakuk|Hab
|
|
47
|
+
Zeph: Zefanja|Zef, Zephanja|Zeph
|
|
48
|
+
Hag: Haggai|Hag
|
|
49
|
+
Zech: Sacharja|Sach
|
|
50
|
+
Mal: Maleachi|Mal
|
|
51
|
+
Matt: Matthäus|Mat|Mt
|
|
52
|
+
Mark: Markus|Mar|Mr
|
|
53
|
+
Luke: Lukas|Luk|Lk
|
|
54
|
+
John: Johannes|Joh|Jh
|
|
55
|
+
Acts: Apostelgeschichte|Apg
|
|
56
|
+
Rom: Römer|Röm|Rö
|
|
57
|
+
1Cor: 1. Korinther|1. Kor|1Ko
|
|
58
|
+
2Cor: 2. Korinther|2. Kor|2Ko
|
|
59
|
+
Gal: Galater|Gal
|
|
60
|
+
Eph: Epheser|Eph
|
|
61
|
+
Phil: Philipper|Phil
|
|
62
|
+
Col: Kolosser|Kol
|
|
63
|
+
1Thess: 1. Thessalonicher|1. Thes|1.Thes|1Thes|1Th
|
|
64
|
+
2Thess: 2. Thessalonicher|2. Thes|2.Thes|2Thes|2Th
|
|
65
|
+
1Tim: 1. Timotheus|1. Tim|1Tim
|
|
66
|
+
2Tim: 2. Timotheus|2. Tim|2Tim
|
|
67
|
+
Titus: Titus|Tit
|
|
68
|
+
Phlm: Philemon|Philem|Phm
|
|
69
|
+
Heb: Hebräer|Heb
|
|
70
|
+
Jas: Jakobus|Jak
|
|
71
|
+
1Pet: 1. Petrus|1. Pet|1Pet|1Pe
|
|
72
|
+
2Pet: 2. Petrus|2. Pet|2Pet|2Pe
|
|
73
|
+
1John: 1. Johannes|1. Joh|1Joh|1Jo
|
|
74
|
+
2John: 2. Johannes|2. Joh|2Joh|2Jo
|
|
75
|
+
3John: 3. Johannes|3. Joh|3Joh|3Jo
|
|
76
|
+
Jude: Judas|Jud
|
|
77
|
+
Rev: Offenbarung|Off
|
|
20
78
|
END
|
|
21
79
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Joh|Jh, Apg, Röm|Rö, 1. Kor|1Ko, 2. Kor|2Ko, Gal, Eph, Phil, Kol,
|
|
29
|
-
1. Thes|1.Thes|1Thes|1Th, 2. Thes|2.Thes|2Thes|2Th, 1. Tim|1Tim, 2. Tim|2Tim, Tit, Philem|Phm, Heb, Jak, 1. Pet|1Pet|1Pe, 2. Pet|2Pet|2Pe,
|
|
30
|
-
1. Joh|1Joh|1Jo, 2. Joh|2Joh|2Jo, 3. Joh|3Joh|3Jo, Jud, Off
|
|
31
|
-
END
|
|
32
|
-
|
|
33
|
-
# Array of book names.
|
|
34
|
-
BOOK_NAMES = Bookorder::CANONICAL.zip(book_names, book_abbrevs).map {|osis_book_id, names, abbrevs| Bookname.new(osis_id: osis_book_id, names: names, abbrevs: abbrevs)}
|
|
35
|
-
|
|
36
|
-
# Map of OSIS book ID to instance of Bookname
|
|
37
|
-
OSIS_BOOK_ID_TO_BOOK_NAME = Bookorder::CANONICAL.zip(BOOK_NAMES).map {|id, n| [id, n]}.to_h
|
|
80
|
+
# Mapping of OSIS book ID to instance of Bookname
|
|
81
|
+
BOOKNAMES_HASH = {}
|
|
82
|
+
booknames.each_line do |l|
|
|
83
|
+
bn = Bookname.parse(l)
|
|
84
|
+
BOOKNAMES_HASH[bn.book_id] = bn
|
|
85
|
+
end
|
|
38
86
|
|
|
39
87
|
# Separator between chapter and verse.
|
|
40
88
|
CV_SEPARATOR = ','
|
|
@@ -76,9 +124,9 @@ module Scripref
|
|
|
76
124
|
POSTFIX_MORE_FOLLOWING_VERSES_RE = /ff\b\s*/o
|
|
77
125
|
|
|
78
126
|
# Check if book has only one chapter
|
|
79
|
-
# @param
|
|
80
|
-
def book_has_only_one_chapter?
|
|
81
|
-
%i[Obad Phlm 2John 3John Jude].include?(
|
|
127
|
+
# @param book_id OSIS-ID of the book
|
|
128
|
+
def book_has_only_one_chapter? book_id
|
|
129
|
+
%i[Obad Phlm 2John 3John Jude].include?(book_id)
|
|
82
130
|
end
|
|
83
131
|
|
|
84
132
|
# Regular expression to match punctuation marks
|