codexparser 0.0.79 → 0.0.80
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/bcv-single-test.js +2 -1
- package/package.json +1 -1
- package/scan-test.js +2 -15
- package/src/CodexParser.js +4 -1
- package/src/abbr.js +0 -1
- package/sub-verse-scripture-test.js +2 -1
- package/tests/find.js +7 -0
package/bcv-single-test.js
CHANGED
|
@@ -4,11 +4,12 @@ const util = require("util")
|
|
|
4
4
|
const dump = (item) => {
|
|
5
5
|
console.log(util.inspect(item, { depth: null, colors: true }))
|
|
6
6
|
}
|
|
7
|
-
const text = "Psalm
|
|
7
|
+
const text = "Psalm 95:6 MT"
|
|
8
8
|
|
|
9
9
|
const parser = new bcv_parser({
|
|
10
10
|
invalid_sequence_strategy: "include",
|
|
11
11
|
invalid_passage_strategy: "include",
|
|
12
|
+
sequence_combination_strategy: "combine"
|
|
12
13
|
})
|
|
13
14
|
const textParser = parser.parse(text)
|
|
14
15
|
console.log(textParser)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.80",
|
|
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/scan-test.js
CHANGED
|
@@ -4,20 +4,7 @@ const util = require("util")
|
|
|
4
4
|
const dump = (item) => {
|
|
5
5
|
console.log(util.inspect(item, { depth: null, colors: true }))
|
|
6
6
|
}
|
|
7
|
-
let text = `
|
|
8
|
-
|
|
9
|
-
Ge 27.27-29,89-40 Heb 11.20 Heb. 12.17 Jonah 3
|
|
10
|
-
|
|
11
|
-
Jd. 5
|
|
12
|
-
Jd 6
|
|
13
|
-
|
|
14
|
-
1 Cor 12:34 2 Cor 3:4. He 4.12 Re 1.16
|
|
15
|
-
|
|
16
|
-
Leviticus 16:6 He 5.3 He 7.27
|
|
17
|
-
|
|
18
|
-
Hos 10:1-3, 8 and 1 John 2:23
|
|
19
|
-
|
|
20
|
-
exod15.18. 2 Cor 12:23 Malachi 3:32`
|
|
7
|
+
let text = `Psalm 94:4-100:6 MT`
|
|
21
8
|
const parser = new BibleParser()
|
|
22
|
-
const result = parser.find(text)
|
|
9
|
+
const result = parser.find(text).enhance()
|
|
23
10
|
dump(result)
|
package/src/CodexParser.js
CHANGED
|
@@ -90,6 +90,7 @@ class CodexParser {
|
|
|
90
90
|
}
|
|
91
91
|
this.passages = []
|
|
92
92
|
this.scan(reference)
|
|
93
|
+
const books = []
|
|
93
94
|
for (let i = 0; i < this.found.length; i++) {
|
|
94
95
|
const result = this.found[i]
|
|
95
96
|
if (result.type === "range" && result.start.b !== result.end.b) {
|
|
@@ -229,6 +230,7 @@ class CodexParser {
|
|
|
229
230
|
return parts
|
|
230
231
|
.join(" ")
|
|
231
232
|
.replace(/\s+:\s+/g, ":")
|
|
233
|
+
.replace(/\s[-–—]\s/, "-")
|
|
232
234
|
.trim()
|
|
233
235
|
}
|
|
234
236
|
find(text) {
|
|
@@ -541,6 +543,7 @@ class CodexParser {
|
|
|
541
543
|
this.found.push(passage.trim())
|
|
542
544
|
newText += "</span> "
|
|
543
545
|
}
|
|
546
|
+
console.log(newText)
|
|
544
547
|
return this
|
|
545
548
|
}
|
|
546
549
|
|
|
@@ -551,7 +554,7 @@ class CodexParser {
|
|
|
551
554
|
original: this.found[i],
|
|
552
555
|
book: this.bookify(this.found[i].match(this.bookRegex)[0]),
|
|
553
556
|
chapter: this.found[i].match(this.chapterRegex),
|
|
554
|
-
verse: this.found[i].match(
|
|
557
|
+
verse: this.found[i].match(this.verseRegex)[0],
|
|
555
558
|
}
|
|
556
559
|
this.passages.push(passage)
|
|
557
560
|
}
|
package/src/abbr.js
CHANGED
|
@@ -10,6 +10,7 @@ parser.options({
|
|
|
10
10
|
invalid_passage_strategy: "include",
|
|
11
11
|
invalid_sequence_strategy: "include",
|
|
12
12
|
single_chapter_1_strategy: "verse",
|
|
13
|
+
sequence_combination_strategy: "combine",
|
|
13
14
|
})
|
|
14
|
-
const result = parser.parse("
|
|
15
|
+
const result = parser.parse("John 3:1-3")
|
|
15
16
|
dump(result.getPassages())
|