codexparser 0.0.45 → 0.0.47
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 +17 -8
- package/bcv_test.js +1 -1
- package/chapter-range-test.js +5 -0
- package/package.json +1 -1
- package/quicktest.js +1 -1
- package/src/CodexParser.js +7 -5
- package/src/regex.js +1 -1
- package/sub-verse-scripture-test.js +1 -1
package/all-scripture-test.js
CHANGED
|
@@ -2,12 +2,21 @@ 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,89-40 Heb 11.20 Heb. 12.17 Jonah 3"
|
|
7
7
|
const jd = "Jd. 5"
|
|
8
|
-
const cor = "
|
|
9
|
-
const
|
|
10
|
-
passages.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const cor = "1 Cor 12:34 2 Cor 3:4"
|
|
9
|
+
const noSpace = 'Re13.8'
|
|
10
|
+
const passages = parser.parse(single)
|
|
11
|
+
console.log(passages)
|
|
12
|
+
|
|
13
|
+
const jude = parser.parse(jd)
|
|
14
|
+
console.log(jude)
|
|
15
|
+
const textParser = parser.parse(cor)
|
|
16
|
+
console.log(textParser)
|
|
17
|
+
|
|
18
|
+
const fullText = parser.parse(text)
|
|
19
|
+
console.log(fullText)
|
|
20
|
+
|
|
21
|
+
const noSpaceText = parser.parse(noSpace)
|
|
22
|
+
console.log(noSpaceText)
|
package/bcv_test.js
CHANGED
|
@@ -3,7 +3,7 @@ const text =
|
|
|
3
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
4
|
const single = "Ge 27.27-29,89-40 Heb 11.20 Heb. 12.17 Jonah 3"
|
|
5
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 He 10:13"
|
|
6
|
+
const cor = "Hos 1:1-3, 8 Song of Solomon 1:2, Song of Songs 2:2. Ezek 17:3. Ezekiel 17:3 He 10:13 Rev 12:13"
|
|
7
7
|
|
|
8
8
|
const parser = new bcv_parser()
|
|
9
9
|
const textParser = parser.parse(text + single + jd + cor.replace(/He/, "Hebrews"))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
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": {
|
package/quicktest.js
CHANGED
package/src/CodexParser.js
CHANGED
|
@@ -15,9 +15,11 @@ class CodexParser {
|
|
|
15
15
|
this.scripturesRegex = scripturesRegex
|
|
16
16
|
this.abbrevations = abbrevations
|
|
17
17
|
this.toc = toc
|
|
18
|
-
this.crawler = new crawler(
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
this.crawler = new crawler()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
options(options) {
|
|
22
|
+
this.crawler.set_options(options)
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
/**
|
|
@@ -78,7 +80,7 @@ class CodexParser {
|
|
|
78
80
|
const found = this.found.filter((passage) => passage.start.b === book)
|
|
79
81
|
booksWithResults.push(found)
|
|
80
82
|
}
|
|
81
|
-
|
|
83
|
+
console.log(booksWithResults[0][0])
|
|
82
84
|
for (let i = 0; i < booksWithResults.length; i++) {
|
|
83
85
|
const initialPassage = booksWithResults[i].shift()
|
|
84
86
|
const shouldBeRange = initialPassage.osis.match(/[-–—]/)
|
|
@@ -100,7 +102,7 @@ class CodexParser {
|
|
|
100
102
|
firstPassage.to = {
|
|
101
103
|
book: this.bookify(initialPassage.end.b),
|
|
102
104
|
chapter: initialPassage.end.c,
|
|
103
|
-
verses: [initialPassage.
|
|
105
|
+
verses: [initialPassage.end.v],
|
|
104
106
|
}
|
|
105
107
|
} else {
|
|
106
108
|
firstPassage.verses = [initialPassage.start.v + "-" + initialPassage.end.v]
|
package/src/regex.js
CHANGED
|
@@ -4,7 +4,7 @@ const verseRegex = /\b[:.].+\b/gm
|
|
|
4
4
|
const chapterRange = /.?\s?(?:[-—–])\s?/gm
|
|
5
5
|
const chapterRangeVerseRegex = /(?:.\d+)?/gm
|
|
6
6
|
const chapterVerseRange =
|
|
7
|
-
/.?\s
|
|
7
|
+
/.?\s?\d+((?:[:.]\d+)?(\s?[-–—]\s?)?(?:\d+)(?:(,\s?\d+)*)?\S([:.]?\d+)?(,\s?\d+[–—-]\s?\d+)?)?(?:[:.]\d+)?(?:[abcde])?(?:,\d+)*(?:[-–—]\d?\s?)?/gim
|
|
8
8
|
const scripturesRegex = new RegExp(`(${bookRegex.source})(${chapterVerseRange.source})`, "gmi")
|
|
9
9
|
module.exports.bookRegex = bookRegex
|
|
10
10
|
module.exports.chapterRegex = chapterRegex
|