codexparser 0.1.48 → 0.1.49
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/package.json +1 -1
- package/src/CodexParser.js +13 -29
- package/src/functions.js +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.49",
|
|
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/src/CodexParser.js
CHANGED
|
@@ -4,6 +4,7 @@ const { bookRegex, chapterRegex, verseRegex, scripturesRegex } = require("./rege
|
|
|
4
4
|
const abbrevations = require("./abbr")
|
|
5
5
|
const dump = require("./functions").dump
|
|
6
6
|
const dd = require("./functions").dd
|
|
7
|
+
const sch = require("./functions").sch
|
|
7
8
|
const chapter_verses = require("./chapterVerseCombine")
|
|
8
9
|
|
|
9
10
|
class CodexParser {
|
|
@@ -18,32 +19,13 @@ class CodexParser {
|
|
|
18
19
|
this.abbreviations = abbrevations
|
|
19
20
|
this.versificationDifferences = versified
|
|
20
21
|
this.singleChapterBook = [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
"2 John": {
|
|
28
|
-
1: Array.from({ length: 13 }, (_, i) => i + 1),
|
|
29
|
-
}, // 2 John has 13 verses
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"3 John": {
|
|
33
|
-
1: Array.from({ length: 15 }, (_, i) => i + 1),
|
|
34
|
-
}, // 3 John has 15 verses
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
Obadiah: {
|
|
38
|
-
1: Array.from({ length: 21 }, (_, i) => i + 1),
|
|
39
|
-
}, // Obadiah has 21 verses
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
Philemon: {
|
|
43
|
-
1: Array.from({ length: 25 }, (_, i) => i + 1),
|
|
44
|
-
}, // Philemon has 25 verses
|
|
45
|
-
},
|
|
22
|
+
sch("Jude", 25),
|
|
23
|
+
sch("2 John", 13),
|
|
24
|
+
sch("3 John", 15),
|
|
25
|
+
sch("Obadiah", 21),
|
|
26
|
+
sch("Philemon", 25),
|
|
46
27
|
]
|
|
28
|
+
|
|
47
29
|
this.chapterVerses = chapter_verses
|
|
48
30
|
this.error = false
|
|
49
31
|
this.version = null
|
|
@@ -586,9 +568,10 @@ class CodexParser {
|
|
|
586
568
|
|
|
587
569
|
// Start constructing the passage string
|
|
588
570
|
let combined = `${passage.book}`
|
|
589
|
-
|
|
571
|
+
|
|
590
572
|
if (passage.type === "multi_chapter_verse_range" && passage.to) {
|
|
591
573
|
// Multi-chapter verse range
|
|
574
|
+
|
|
592
575
|
combined += ` ${formatChapterVerse(passage.chapter, passage.verses)}-${formatChapterVerse(
|
|
593
576
|
passage.to.chapter,
|
|
594
577
|
passage.to.verses
|
|
@@ -700,6 +683,7 @@ class CodexParser {
|
|
|
700
683
|
|
|
701
684
|
// Handle multi-chapter ranges
|
|
702
685
|
if (firstChapter !== lastChapter) {
|
|
686
|
+
|
|
703
687
|
combined.type = "multi_chapter_verse_range"
|
|
704
688
|
combined.to = {
|
|
705
689
|
book: combined.book,
|
|
@@ -708,7 +692,7 @@ class CodexParser {
|
|
|
708
692
|
}
|
|
709
693
|
combined.original = `${combined.book} ${firstChapter}:${combined.verses.join(
|
|
710
694
|
","
|
|
711
|
-
)}
|
|
695
|
+
)}; ${lastChapter}:${combined.to.verses.join(",")}`
|
|
712
696
|
} else {
|
|
713
697
|
// Single-chapter range or comma-separated
|
|
714
698
|
if (combined.verses.length > 1) {
|
|
@@ -720,11 +704,11 @@ class CodexParser {
|
|
|
720
704
|
}
|
|
721
705
|
|
|
722
706
|
// Build the scripture property
|
|
723
|
-
const chapterString = chapterStrings.join("
|
|
707
|
+
const chapterString = chapterStrings.join(";")
|
|
724
708
|
combined.scripture = {
|
|
725
709
|
passage: `${combined.book} ${chapterString}`,
|
|
726
710
|
cv: chapterString,
|
|
727
|
-
hash: `${combined.book.toLowerCase()}_${chapterString.replace(/:/g, ".").replace(
|
|
711
|
+
hash: `${combined.book.toLowerCase()}_${chapterString.replace(/:/g, ".").replace(/,|;/g, ".")}`,
|
|
728
712
|
}
|
|
729
713
|
if (combined.to === null) {
|
|
730
714
|
delete combined.to
|
package/src/functions.js
CHANGED
|
@@ -10,7 +10,18 @@ function dd(message) {
|
|
|
10
10
|
process.exit(1)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
function sch(bookName, verseCount) {
|
|
15
|
+
return {
|
|
16
|
+
[bookName]: {
|
|
17
|
+
1: Array.from({ length: verseCount }, (_, i) => i + 1),
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
13
23
|
module.exports = {
|
|
14
24
|
dump,
|
|
15
25
|
dd,
|
|
26
|
+
sch
|
|
16
27
|
}
|