codexparser 0.0.11 → 0.0.12
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 +1 -0
- package/src/regex.js +8 -3
- package/test.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
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
|
@@ -39,6 +39,7 @@ class CodexParser {
|
|
|
39
39
|
}
|
|
40
40
|
this.passages = []
|
|
41
41
|
this.scan(reference)
|
|
42
|
+
console.log(this.found)
|
|
42
43
|
for (let i = 0; i < this.found.length; i++) {
|
|
43
44
|
const book = this.found[i].match(this.bookRegex)
|
|
44
45
|
const chapter = this.found[i].replace(book[0], "").match(this.chapterRegex)
|
package/src/regex.js
CHANGED
|
@@ -3,8 +3,13 @@ const bookRegex =
|
|
|
3
3
|
const bookAbbrRegex =
|
|
4
4
|
/(?:(?:[gG]en|[eE]xo|[lL]ev|[nN]um|[dD]eu|[jJ]os|[jJ]dg|[rR]ut|1 [sS]a|2 [sS]a|1 [kK]gs|2 [kK]gs|1 [cC]hr|2 [cC]hr|[eE]zr|[nN]eh|[eE]st|[jJ]ob|[pP]sa|[pP]ro|[eE]cc|[sS]on|[iI]sa|[jJ]er|[lL]am|[eE]ze|[dD]an|[hH]os|[jJ]oe|[aA]mo|[oO]ba|[jJ]on|[mM]ic|[nN]ah|[hH]ab|[zZ]ep|[hH]ag|[zZ]ec|[mM]al|[mM]att|[mM]ar|[lL]uk|[jJ]oh|[aA]ct|[rR]om|1 [cC]or|2 [cC]or|[gG]al|[eE]ph|[pP]hi|[cC]ol|1 [tT]hess|2 [tT]hess|1 [tT]i|2 [tT]i|[tT]it|[pP]hm|[hH]eb|[jJ]am|1 [pP]e|2 [pP]e|1 [jJ]o|2 [jJ]o|3 [jJ]o|[jJ]ud|[rR]ev))/gim
|
|
5
5
|
const chapterRegex = /(?:\s?\d+:?)/g
|
|
6
|
-
const verseRegex = /\b[
|
|
7
|
-
const
|
|
6
|
+
const verseRegex = /\b[:|\.]\s*?(\d+(?:,?\s*?\d+?|-|–|—\d+)*)?\d+(?!p|j|k|s|c|t)\b/g
|
|
7
|
+
const chapterRange = /\s?(?:[-|—|–])\s?/g
|
|
8
|
+
const chapterRangeVerseRegex = /./gm
|
|
9
|
+
const scripturesRegex = new RegExp(
|
|
10
|
+
`(${bookRegex.source})(${chapterRegex.source})?(${verseRegex.source})(${chapterRange.source})?((${chapterRegex.source})?(${verseRegex.source})?)(${chapterRangeVerseRegex.source})?`,
|
|
11
|
+
"gm"
|
|
12
|
+
)
|
|
8
13
|
const abbrScripturesRegex = new RegExp(`(${bookAbbrRegex.source})(${chapterRegex.source})?(${verseRegex.source})`, "gm")
|
|
9
14
|
|
|
10
15
|
module.exports.bookRegex = bookRegex
|
|
@@ -12,4 +17,4 @@ module.exports.bookAbbrRegex = bookAbbrRegex
|
|
|
12
17
|
module.exports.chapterRegex = chapterRegex
|
|
13
18
|
module.exports.scripturesRegex = scripturesRegex
|
|
14
19
|
module.exports.abbrScripturesRegex = abbrScripturesRegex
|
|
15
|
-
module.exports.verseRegex = verseRegex
|
|
20
|
+
module.exports.verseRegex = verseRegex
|
package/test.js
CHANGED
|
@@ -3,7 +3,7 @@ const CodexParser = require("./src/CodexParser.js")
|
|
|
3
3
|
const parser = new CodexParser()
|
|
4
4
|
const text =
|
|
5
5
|
"The passages that we are looking at tonight are found in 1 John 3:16-17, 1 Peter 1:1, and Romans 10:13, 15, 17. Please turn in your Bibles."
|
|
6
|
-
const single = "Ge 2:9"
|
|
6
|
+
const single = "Ge 2:9-3:3-2 and 2 Cor 2:2"
|
|
7
7
|
parser.parse(single)
|
|
8
8
|
//parser.parse(single)
|
|
9
9
|
console.log(parser.getPassages())
|