codexparser 0.0.32 → 0.0.34
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.
- package/all-scripture-test.js +5 -15
- package/bcv_test.js +14 -0
- package/package.json +4 -1
- package/passage-generator.js +25 -0
- package/src/CodexParser.js +116 -15
- package/src/abbr.js +0 -2
- package/src/bookRegex.regex +1 -0
- package/src/regex.js +3 -3
- package/sub-verse-scripture-test.js +3 -3
package/all-scripture-test.js
CHANGED
|
@@ -2,19 +2,9 @@ const CodexParser = require("./src/CodexParser.js")
|
|
|
2
2
|
|
|
3
3
|
const parser = new CodexParser()
|
|
4
4
|
const text =
|
|
5
|
-
"Joel 10:13 The passages Luke 2:32 and Lk 1:23 that we are looking at tonight 1 Cor 12:34 2 Cor 3:4 are found Jude 6, in Jude 5, Genesis 2:1 - 3:19, 1 John 3:16-17,
|
|
6
|
-
const single = "Ge 27.27-29,
|
|
5
|
+
"Joel 10:13 The passages Luke 2:32 and Lk 1:23 that we are looking at tonight 1 Cor 12:34 2 Cor 3:4 are found Jude 6, in Jude 5, Genesis 2:1 - 3:19, 1 John 3:16-17, 1 Peter 1:1, and Romans 10:13, 15, 17. Please turn in your Bibles. Ps 109:4,5,6,8. Isaiah 61.2-3 Mt 5.4"
|
|
6
|
+
const single = "Ge 27.27-29,32-40 Heb 11.20 Heb. 12.17 Jonah 3"
|
|
7
7
|
const jd = "Jd. 5"
|
|
8
|
-
const cor = "Hos 1:1-3, 8 Song of Solomon 1:2, Song of Songs 2:2"
|
|
9
|
-
const passages = parser.parse(single)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const jude = parser.parse(jd)
|
|
13
|
-
console.log(jude)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const fullText = parser.parse(text)
|
|
17
|
-
console.log(fullText)
|
|
18
|
-
|
|
19
|
-
const textParser = parser.parse(cor)
|
|
20
|
-
console.log(textParser)
|
|
8
|
+
const cor = "Hos 1:1-3, 8 Song of Solomon 1:2, Song of Songs 2:2. Ezek 17:3. Ezekiel 17:3"
|
|
9
|
+
const passages = parser.parse(single + " " + text + " " + jd + " " + cor)
|
|
10
|
+
//const passages = parser.parse('Romans 8:9,12,15,17,20,28')
|
package/bcv_test.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const bcv_parser = require("bible-passage-reference-parser/js/en_bcv_parser").bcv_parser
|
|
2
|
+
const text =
|
|
3
|
+
"Joel 10:13 The passages Luke 2:32 and Lk 1:23 that we are looking at tonight 1 Cor 12:34 2 Cor 3:4 are found Jude 6, in Jude 5, Genesis 2:1 - 3:19, 1 John 3:16-17, 1 Peter 1:1, and Romans 10:13, 15, 17. Please turn in your Bibles. Ps 109:4,5,6,8. Isaiah 61.2-3 Mt 5.4"
|
|
4
|
+
const single = "Ge 27.27-29,89-40 Heb 11.20 Heb. 12.17 Jonah 3"
|
|
5
|
+
const jd = "Jd. 5"
|
|
6
|
+
const cor = "Hos 1:1-3, 8 Song of Solomon 1:2, Song of Songs 2:2. Ezek 17:3. Ezekiel 17:3"
|
|
7
|
+
|
|
8
|
+
const parser = new bcv_parser()
|
|
9
|
+
const textParser = parser.parse(text + single + jd + cor)
|
|
10
|
+
const passages = textParser.parsed_entities()
|
|
11
|
+
|
|
12
|
+
passages.forEach((passage) => {
|
|
13
|
+
console.log(passage.entities)
|
|
14
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"description": "This is a Javascript Bible parser and text scanner. It will search through texts and collate all scripture references into an array and parse them into objects, and it will parse passages into objects by book, chapter, verse, and testament. ",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,5 +20,8 @@
|
|
|
20
20
|
"path": "^0.12.7",
|
|
21
21
|
"webpack": "^5.90.3",
|
|
22
22
|
"webpack-cli": "^5.1.4"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"bible-passage-reference-parser": "^2.0.1"
|
|
23
26
|
}
|
|
24
27
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function generateScriptureCombinations(book, chapters, versesPerChapter) {
|
|
2
|
+
let scriptureCombinations = []
|
|
3
|
+
|
|
4
|
+
for (let chapter = 1; chapter <= chapters; chapter++) {
|
|
5
|
+
for (let verse = 1; verse <= versesPerChapter[chapter - 1]; verse++) {
|
|
6
|
+
// Single verse
|
|
7
|
+
scriptureCombinations.push(`${book} ${chapter}:${verse}`)
|
|
8
|
+
// Verse ranges within a chapter
|
|
9
|
+
for (let endVerse = verse + 1; endVerse <= versesPerChapter[chapter - 1]; endVerse++) {
|
|
10
|
+
scriptureCombinations.push(`${book} ${chapter}:${verse}-${endVerse}`)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
// Chapter ranges
|
|
14
|
+
for (let endChapter = chapter + 1; endChapter <= chapters; endChapter++) {
|
|
15
|
+
scriptureCombinations.push(`${book} ${chapter}:${versesPerChapter[chapter - 1]}-${endChapter}:1`)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return scriptureCombinations
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Example usage for the book of Genesis (assuming 50 chapters and a fixed number of verses per chapter for simplicity)
|
|
23
|
+
const genesisVersesPerChapter = new Array(50).fill(30) // Replace with actual verse count per chapter
|
|
24
|
+
const genesisCombinations = generateScriptureCombinations("Genesis", 50, genesisVersesPerChapter)
|
|
25
|
+
console.log(genesisCombinations.join(", "))
|
package/src/CodexParser.js
CHANGED
|
@@ -2,6 +2,7 @@ const bible = require("./bible")
|
|
|
2
2
|
const { bookRegex, chapterRegex, verseRegex, scripturesRegex } = require("./regex")
|
|
3
3
|
const abbrevations = require("./abbr")
|
|
4
4
|
const toc = require("./toc")
|
|
5
|
+
const crawler = require("bible-passage-reference-parser/js/en_bcv_parser").bcv_parser
|
|
5
6
|
|
|
6
7
|
class CodexParser {
|
|
7
8
|
constructor() {
|
|
@@ -14,6 +15,9 @@ class CodexParser {
|
|
|
14
15
|
this.scripturesRegex = scripturesRegex
|
|
15
16
|
this.abbrevations = abbrevations
|
|
16
17
|
this.toc = toc
|
|
18
|
+
this.crawler = new crawler({
|
|
19
|
+
sequence_combination_strategy: "separate",
|
|
20
|
+
})
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
/**
|
|
@@ -23,16 +27,8 @@ class CodexParser {
|
|
|
23
27
|
* @return {array} The found passages from the text.
|
|
24
28
|
*/
|
|
25
29
|
scan(text) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
this.found = text.match(this.scripturesRegex)
|
|
29
|
-
if (!this.found) {
|
|
30
|
-
this.found = []
|
|
31
|
-
}
|
|
32
|
-
if (jude) {
|
|
33
|
-
this.found.push(...jude)
|
|
34
|
-
}
|
|
35
|
-
return this.found
|
|
30
|
+
const passages = this.crawler.parse(text).parsed_entities()
|
|
31
|
+
this.found.push(...passages.flatMap((passage) => passage.entities))
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
/**
|
|
@@ -43,11 +39,106 @@ class CodexParser {
|
|
|
43
39
|
*/
|
|
44
40
|
parse(reference) {
|
|
45
41
|
if (!reference) {
|
|
46
|
-
|
|
42
|
+
throw new Error("Parse error (parse(), line 46): reference is undefined")
|
|
47
43
|
}
|
|
48
44
|
this.passages = []
|
|
49
45
|
this.scan(reference)
|
|
46
|
+
const books = []
|
|
50
47
|
for (let i = 0; i < this.found.length; i++) {
|
|
48
|
+
books.push(this.found[i].start.b)
|
|
49
|
+
}
|
|
50
|
+
const uniqueBooks = [...new Set(books)]
|
|
51
|
+
const booksWithResults = []
|
|
52
|
+
//TODO: Need to loop through and create an array of all the same passage
|
|
53
|
+
// in order to be able to identify if comma separated verses goes with it or not.
|
|
54
|
+
for (const book of uniqueBooks) {
|
|
55
|
+
const found = this.found.filter((passage) => passage.start.b === book)
|
|
56
|
+
booksWithResults.push(found)
|
|
57
|
+
}
|
|
58
|
+
//console.log(booksWithResults)
|
|
59
|
+
for (let i = 0; i < booksWithResults.length; i++) {
|
|
60
|
+
const initialPassage = booksWithResults[i].shift()
|
|
61
|
+
const firstPassage = {
|
|
62
|
+
original: initialPassage.osis,
|
|
63
|
+
book: this.bookify(initialPassage.start.b),
|
|
64
|
+
chapter: initialPassage.start.c,
|
|
65
|
+
type: initialPassage.type,
|
|
66
|
+
entities: initialPassage.entities,
|
|
67
|
+
}
|
|
68
|
+
if (initialPassage.type === "range") {
|
|
69
|
+
if (initialPassage.start.c !== initialPassage.end.c) {
|
|
70
|
+
firstPassage.verses = [initialPassage.start.v]
|
|
71
|
+
firstPassage.to = {
|
|
72
|
+
book: this.bookify(initialPassage.end.b),
|
|
73
|
+
chapter: initialPassage.end.c,
|
|
74
|
+
verses: [initialPassage.start.v],
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
firstPassage.verses = [initialPassage.start.v + "-" + initialPassage.end.v]
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
firstPassage.verses =
|
|
81
|
+
initialPassage.start.v !== initialPassage.end.v
|
|
82
|
+
? [initialPassage.start.v, initialPassage.end.v]
|
|
83
|
+
: [initialPassage.start.v]
|
|
84
|
+
}
|
|
85
|
+
console.log("First Passage, First Log: ", firstPassage)
|
|
86
|
+
for (let j = 0; j < booksWithResults[i].length; j++) {
|
|
87
|
+
const passage = booksWithResults[i][j]
|
|
88
|
+
if (passage.type === "integer") {
|
|
89
|
+
if (firstPassage.type === "range") {
|
|
90
|
+
if (passage.start.c !== passage.end.c) {
|
|
91
|
+
firstPassage.to.verses.push(passage.start.v)
|
|
92
|
+
} else {
|
|
93
|
+
firstPassage.verses.push(passage.start.v)
|
|
94
|
+
}
|
|
95
|
+
firstPassage.original += ", " + passage.start.v
|
|
96
|
+
} else {
|
|
97
|
+
if (passage.start.v !== passage.end.v) {
|
|
98
|
+
firstPassage.verses.push(passage.start.v)
|
|
99
|
+
firstPassage.verses.push(passage.end.v)
|
|
100
|
+
firstPassage.original += ", " + passage.start.v + ", " + passage.end.v
|
|
101
|
+
} else {
|
|
102
|
+
firstPassage.verses.push(passage.start.v)
|
|
103
|
+
firstPassage.original += ", " + passage.start.v
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
} else if (passage.type === "range") {
|
|
107
|
+
if (firstPassage.chapter === passage.start.c) {
|
|
108
|
+
firstPassage.verses.push(passage.start.v + "-" + passage.end.v)
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
const subPassage = {
|
|
112
|
+
original: passage.osis,
|
|
113
|
+
book: this.bookify(passage.start.b),
|
|
114
|
+
chapter: passage.start.c,
|
|
115
|
+
type: passage.type,
|
|
116
|
+
entities: passage.entities,
|
|
117
|
+
}
|
|
118
|
+
if (passage.type === "range") {
|
|
119
|
+
if (passage.start.c !== passage.end.c) {
|
|
120
|
+
subPassage.to = {
|
|
121
|
+
book: this.bookify(passage.end.b),
|
|
122
|
+
chapter: passage.end.c,
|
|
123
|
+
verses: [passage.end.v],
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
subPassage.verses =
|
|
127
|
+
passage.start.v !== passage.end.v ? [passage.start.v, passage.end.v] : [passage.start.v]
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
subPassage.verses =
|
|
131
|
+
passage.start.v !== passage.end.v ? [passage.start.v, passage.end.v] : [passage.start.v]
|
|
132
|
+
}
|
|
133
|
+
this.passages.push(subPassage)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
console.log(firstPassage)
|
|
137
|
+
this.passages.push(firstPassage)
|
|
138
|
+
//console.log(this.passages)
|
|
139
|
+
}
|
|
140
|
+
//console.log(booksWithResults)
|
|
141
|
+
/* for (let i = 0; i < this.found.length; i++) {
|
|
51
142
|
const hasChapterRange = this.found[i].match(/(?<=-\s?)\b\d+[.:].+\b/)
|
|
52
143
|
const book = this.found[i].match(this.bookRegex)
|
|
53
144
|
if (book === null) continue
|
|
@@ -89,10 +180,18 @@ class CodexParser {
|
|
|
89
180
|
}
|
|
90
181
|
|
|
91
182
|
this.found = []
|
|
92
|
-
return this.passages
|
|
183
|
+
return this.passages */
|
|
93
184
|
}
|
|
94
185
|
chapterify(chapter) {
|
|
95
|
-
|
|
186
|
+
if (chapter.type === "range") {
|
|
187
|
+
return `${chapter.start.c} - ${chapter.end}`
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
versify(passage, type) {
|
|
192
|
+
if (type !== "range")
|
|
193
|
+
return passage.start.v !== passage.end.v ? [passage.start.v, passage.end.v] : [passage.start.v]
|
|
194
|
+
else return [passage.start.v + "-" + passage.end.v]
|
|
96
195
|
}
|
|
97
196
|
|
|
98
197
|
/**
|
|
@@ -102,10 +201,11 @@ class CodexParser {
|
|
|
102
201
|
* @return {string|undefined} The full name of the book if found, otherwise undefined.
|
|
103
202
|
*/
|
|
104
203
|
bookify(book) {
|
|
204
|
+
if(typeof book !== "string") {
|
|
205
|
+
book = book[0]
|
|
206
|
+
}
|
|
105
207
|
let bookified
|
|
106
|
-
book = book[0].charAt(0).toUpperCase() + book[0].slice(1)
|
|
107
208
|
bookified = this.abbrevations[book]
|
|
108
|
-
|
|
109
209
|
if (!bookified) {
|
|
110
210
|
bookified = this.bible.new.find(
|
|
111
211
|
(b) =>
|
|
@@ -136,6 +236,7 @@ class CodexParser {
|
|
|
136
236
|
* @param {object} passage - A passage object
|
|
137
237
|
*/
|
|
138
238
|
scripturize(passage) {
|
|
239
|
+
console.log(passage)
|
|
139
240
|
const { book, chapter, verses, to } = passage
|
|
140
241
|
const colon = verses.length !== 0 ? ":" : ""
|
|
141
242
|
const parts = [book, chapter, colon, verses]
|
package/src/abbr.js
CHANGED
|
@@ -81,7 +81,6 @@ const abbrevations = {
|
|
|
81
81
|
"II Ch": "2 Chronicles",
|
|
82
82
|
Ezra: "Ezra",
|
|
83
83
|
Ezr: "Ezra",
|
|
84
|
-
Ez: "Ezra",
|
|
85
84
|
Neh: "Nehemiah",
|
|
86
85
|
Ne: "Nehemiah",
|
|
87
86
|
Esth: "Esther",
|
|
@@ -263,7 +262,6 @@ const abbrevations = {
|
|
|
263
262
|
"1K": "1 Corinthians",
|
|
264
263
|
"2K": "2 Corinthians",
|
|
265
264
|
G: "Galatians",
|
|
266
|
-
E: "Ephesians",
|
|
267
265
|
Ph: "Philippians",
|
|
268
266
|
Kol: "Colossians",
|
|
269
267
|
"1Th": "1 Thessalonians",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Genesis|Gen|Ge|Gn|Ex|Exo|Exod|Exodus|Exodus|Leviticus|Lev|Le|Lv|Numbers|Num|Nu|Deuteronomy|Dt|Dt|Joshua|Josh|Jsh|Judges|Jdg|Jdg|Ruth|Rth|Ru|1 Samuel|1 Sam|1 Sa|1 S|I Sam|I Sa|1Sam|1Sa|1S|1st Samuel|1st Sam|First Samuel|First Sam|2 Samuel|2 Sam|2 Sa|2 S|II Sam|II Sa|2Sam|2Sa|2S|2nd Samuel|2nd Sam|Second Samuel|Second Sam|1 Kings|1 Kgs|1 Ki|1Kgs|1Kin|1Ki|1K|I Kgs|I Ki|1st Kings|1st Kgs|2 Kings|2 Kgs|2 Ki|2Kgs|2Kin|2Ki|2K|II Kgs|II Ki|2nd Kings|2nd Kgs|1 Chronicles|1 Chron|1 Chr|1 Ch|1Chron|1Chr|1Ch|I Chron|I Chr|I Ch|1st Chronicles|1st Chron|First Chronicles|First Chron|2 Chronicles|2 Chron|2 Chr|2 Ch|2Chron|2Chr|2Ch|II Chron|II Chr|II Ch|2nd Chronicles|2nd Chron|Second Chronicles|Second Chron|Ezra|Ezr|Ezr|Ez|Nehemiah|Neh|Ne|Esther|Esth|Es|Job|Jb|Job|Jb|Psalms|Ps|Psalm|Pslm|Psa|Psm|Pss|Proverbs|Prov|Pro|Prv|Pr|Ecclesiastes|Eccles|Eccle|Ecc|Ec|Qoh|Song of Solomon|Song|SOS|So|Canticle of Canticles|Canticles|Cant|Isaiah|Isa|Is|Jeremiah|Jer|Je|Jr|Lamentations|Lam|La|Ezekiel|Ezek|Eze|Ezk|Daniel|Dan|Da|Dn|Hosea|Hos|Ho|Joel|Joel|Jl|Amos|Amos|Am|Obadiah|Obad|Ob|Jonah|Jonah|Jnh|Jon|Micah|Mic|Mc|Nahum|Nah|Na|Habakkuk|Hab|Hb|Zephaniah|Zeph|Zep|Zp|Haggai|Hag|Hg|Zechariah|Zechar|Zech|Zec|Zc|Malachi|Mal|Ml|Matthew|Matt|Mt|Mark|Mrk|Mar|Mk|Mr|Luke|Luk|Lk|John|Joh|Jhn|Jn|Acts|Act|Ac|Romans|Rom|Ro|Rm1Corinthians|1Cor|1Co|ICor|ICo|1Cor|1Co|ICorinthians|1Corinthians|1stCorinthians|FirstCorinthians|2Corinthians|2 Cor|2 Co|II Cor|II Co|2Cor|2Co|II Corinthians|2Corinthians|2nd Corinthians|Second Corinthians|Galatians|Gal|Ga|Ephesians|Eph|Ephes|Philippians|Phil|Php|Pp|Colossians|Col|Co|1 Thessalonians|1 Thess|1 Thes|1 Th|I Thessalonians|I Thess|I Thes|I Th|1Thessalonians|1Thess|1Thes|1Th|1st Thessalonians|1st Thess|First Thessalonians|First Thess|2 Thessalonians|2 Thess|2 Thes|2 Th|II Thessalonians|II Thess|II Thes|II Th|2Thessalonians|2Thess|2Thes|2Th|2nd Thessalonians|2nd Thess|Second Thessalonians|Second Thess|1 Timothy|1 Tim|1 Ti|I Timothy|I Tim|I Ti|1Timothy|1Tim|1Ti|1st Timothy|1st Tim|First Timothy|First Tim|2 Timothy|2 Tim|2 Ti|II Timothy|II Tim|II Ti|2Timothy|2Tim|2Ti|2nd Timothy|2nd Tim|Second Timothy|Second Tim|Titus|titus|tit|ti|Philemon|Philem|Phm|Pm|He|Hebrews|Heb|James|James|Jas|Jm|1 Peter|1 Pet|1 Pe|1 Pt|1 P|I Pet|I Pt|I Pe|1Peter|1Pet|1Pe|1Pt|1P|I Peter|1st Peter|First Peter|2 Peter|2 Pet|2 Pe|2 Pt|2 P|II Peter|II Pet|II Pt|II Pe|2Peter|2Pet|2Pe|2Pt|2P|II Peter|2nd Peter|Second Peter|1 John|1 Jhn|1 Jn|1 J|1John|1Jhn|1Joh|1Jn|1Jo|1J|I John|I Jhn|I Joh|I Jn|I Jo|1st John|First John|2 John|2 Jhn|2 Jn|2 J|2John|2Jhn|2Joh|2Jn|2Jo|2J|II John|II Jhn|II Joh|II Jn|II Jo|2nd John|Second John|3 John|3 Jhn|3 Jn|3 J|3John|3Jhn|3Joh|3Jn|3Jo|3J|III John|III Jhn|III Joh|III Jn|III Jo|3rd John|Third John|Jude|Jud|Jd|Revelation|Rev|Rev|The Revelation|Apoc
|
package/src/regex.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const bookRegex = /(?:(I+|1st|2nd|3rd|First|Second|Third|[123])\s)?(Gen|Ge|Gn|Exo|Ex|Exod|Lev|Le|Lv|Num|Nu|Nm|Nb|Deut|Dt|Josh|Jos|Jsh|Judg|Jdg|Jg|Jdgs|Rth|Ru|Sam|Samuel|Kings|Kgs|Kin|Chron|Chronicles|Ezra|Ezr|Ez|Neh|Ne|Esth|Es|Job|Job|Jb|Pslm|Ps|Psalms|Psa|Psm|Pss|Prov|Pr|Prv|Eccles|Ec|Song|So|Canticles|Song of Songs|SOS|
|
|
1
|
+
const bookRegex = /((?:(I+|1st|2nd|3rd|First|Second|Third|[123])\s)?(Gen|Ge|Gn|Exo|Ex|Exod|Lev|Le|Lv|Num|Nu|Nm|Nb|Deut|Dt|Josh|Jos|Jsh|Judg|Jdg|Jg|Jdgs|Rth|Ru|Sam|Samuel|Kings|Kgs|Kin|Chron|Chronicles|Ezra|Ezr|Ez|Neh|Ne|Esth|Es|Job|Job|Jb|Pslm|Ps|Psalms|Psa|Psm|Pss|Prov|Pr|Prv|Eccles|Ec|Song|So|Canticles|Song of Songs|SOS|Isa|Is|Jer|Je|Jr|Lam|La|Ezek|Eze|Ezk|Dan|Da|Dn|Hos|Ho|Joel|Joe|Jl|Amos|Am|Obad|Ob|Jnh|Jon|Micah|Mic|Nah|Na|Hab|Zeph|Zep|Zp|Haggai|Hag|Hg|Zech|Zec|Zc|Mal|Mal|Ml|Matt|Mt|Mrk|Mk|Mr|Luk|Lk|John|Jn|Jhn|Acts|Ac|Rom|Ro|Rm|Co|Cor|Corinthians|Gal|Ga|Ephes|Eph|Phil|Php|Col|Col|Th|Thes|Thess|Thessalonians|Ti|Tim|Timothy|Titus|Tit|Philem|Phm|Hebrews|Heb|He|James|Jas|Jm|Pe|Pet|Pt|Peter|Jn|Jo|Joh|Jhn|John|Jude|Jd|Jud|Jud|Rev|The Revelation|Genesis|Exodus|Leviticus|Numbers|Deuteronomy|Joshua|Judges|Ruth|Samuel|Kings|Chronicles|Ezra|Nehemiah|Esther|Job|Psalms|Psalm|Proverbs|Ecclesiastes|Song of Solomon|Isaiah|Jeremiah|Lamentations|Ezekiel|Daniel|Hosea|Joel|Amos|Obadiah|Jonah|Micah|Nahum|Habakkuk|Zephaniah|Haggai|Zechariah|Malachi|Matthew|Mark|Luke|John|Acts|Romans|Corinthians|Galatians|Ephesians|Philippians|Colossians|Thessalonians|Timothy|Titus|Philemon|Hebrews|James|Peter|John|Revelation|Re|Ap))/gmi
|
|
2
2
|
const chapterRegex = /\b(?:\.?\s?\d+[:|\.]?)\b/gm
|
|
3
|
-
const verseRegex =
|
|
3
|
+
const verseRegex = /\b[:.].+\b/gm
|
|
4
4
|
const chapterRange = /.?\s?(?:[-—–])\s?/gm
|
|
5
5
|
const chapterRangeVerseRegex = /(?:.\d+)?/gm
|
|
6
6
|
const chapterVerseRange =
|
|
7
|
-
|
|
7
|
+
/.?(?:\d+)((?:[:.])(?:(\d+)?)(?:(,\s?\d+)*)?(?:\s?[-–—]\s?\d+)?(?:,\s?\d+(?:\s?[-–—]\s?\d+)?)?(?:[:.]\d+)?)?/gim
|
|
8
8
|
const scripturesRegex = new RegExp(`(${bookRegex.source})(${chapterVerseRange.source})`, "gmi")
|
|
9
9
|
module.exports.bookRegex = bookRegex
|
|
10
10
|
module.exports.chapterRegex = chapterRegex
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const CodexParser = require("./src/CodexParser.js")
|
|
2
2
|
|
|
3
3
|
const parser = new CodexParser()
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const scripture = "Hos 1:1-3, 8"
|
|
5
|
+
console.log(scripture)
|
|
6
|
+
parser.parse(`${scripture}. Please turn in your Bibles.`)
|