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.
@@ -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, 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"
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 = "Song of Solomon 1:2, Song of Songs 2:2. Ezek 17:3. He 12:13-15 Hos 1:1-3, 8 "
9
- const passages = parser.parse(single + " " + text + " " + jd + " " + cor)
10
- passages.getPassages().forEach(passage => {
11
- console.log(passage)
12
- })
13
- //const passages = parser.parse('Romans 8:9,12,15,17,20,28')
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"))
@@ -0,0 +1,5 @@
1
+ const BibleParser = require("./src/CodexParser.js")
2
+ const string = "Psalms 113-118"
3
+ const parser = new BibleParser()
4
+ const passages = parser.parse(string)
5
+ console.log(passages.getPassages()[0])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexparser",
3
- "version": "0.0.45",
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
@@ -1,5 +1,5 @@
1
1
  const BibleParser = require("./src/CodexParser.js")
2
- const string = "Genesis 1:1 He 4.4"
2
+ const string = "Rev 12:18"
3
3
  const parser = new BibleParser()
4
4
  const result = parser.parse(string)
5
5
  console.log(result.getPassages())
@@ -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
- sequence_combination_strategy: "separate",
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
- //console.log(booksWithResults)
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.start.v],
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?(?:\d+[:.])?\d+[a-e]?(?:(?:\s?[-–—]|,)(?!\s[1-3]\s+[A-Z])\s?(?:\d+[:.])?\d+[a-e]?)*/gim
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
@@ -1,5 +1,5 @@
1
1
  const BibleParser = require("./src/CodexParser.js")
2
- const string = "Ps 109:4,5"
2
+ const string = "Rev 12:18"
3
3
  const parser = new BibleParser()
4
4
  const result = parser.parse(string)
5
5
  console.log(result.getPassages())