codexparser 0.0.65 → 0.0.67
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 +2 -5
- package/package.json +1 -1
- package/src/CodexParser.js +34 -51
- package/sub-verse-scripture-test.js +1 -1
package/all-scripture-test.js
CHANGED
|
@@ -9,14 +9,11 @@ const parser = new CodexParser({
|
|
|
9
9
|
invalid_sequence_strategy: "include",
|
|
10
10
|
invalid_passage_strategy: "include",
|
|
11
11
|
})
|
|
12
|
-
const text =
|
|
13
|
-
"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"
|
|
12
|
+
const text = `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`
|
|
14
13
|
const single = "Ge 27.27-29,89-40 Heb 11.20 Heb. 12.17 Jonah 3"
|
|
15
14
|
const jd = "Jd. 5"
|
|
16
15
|
const cor = "1 Cor 12:4 2 Cor 3:4"
|
|
17
16
|
const noSpace = "Re13.8 "
|
|
18
17
|
const ezra = " Ez 1:3"
|
|
19
18
|
const passages = parser.parse(text + single + jd + cor + noSpace + ezra)
|
|
20
|
-
passages.getPassages()
|
|
21
|
-
dump(passage)
|
|
22
|
-
})
|
|
19
|
+
dump(passages.getPassages())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.67",
|
|
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
|
@@ -89,63 +89,46 @@ class CodexParser {
|
|
|
89
89
|
}
|
|
90
90
|
this.passages = []
|
|
91
91
|
this.scan(reference)
|
|
92
|
-
const books = []
|
|
93
92
|
for (let i = 0; i < this.found.length; i++) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
verses
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
while (next && next.type === "integer" && next.end.c === result.start.c) {
|
|
118
|
-
passage.verses.push(next.start.v)
|
|
119
|
-
if (next.end.v !== next.start.v) passage.verses.push(next.end.v)
|
|
120
|
-
passage.subType = next.type
|
|
121
|
-
j++
|
|
122
|
-
next = results[j + 1]
|
|
123
|
-
}
|
|
124
|
-
if (passage.type === "range") {
|
|
125
|
-
if (result.start.c !== result.end.c) {
|
|
126
|
-
passage.verses = [result.start.v]
|
|
127
|
-
passage.to = {
|
|
128
|
-
book: this.bookify(result.end.b),
|
|
129
|
-
chapter: result.end.c,
|
|
130
|
-
verses: result.end.v,
|
|
131
|
-
}
|
|
93
|
+
const result = this.found[i]
|
|
94
|
+
const passage = {
|
|
95
|
+
book: this.bookify(result.start.b),
|
|
96
|
+
chapter: result.start.c,
|
|
97
|
+
verses: this.versify(result),
|
|
98
|
+
type: result.type,
|
|
99
|
+
}
|
|
100
|
+
passage.testament = this.bible.old.includes(passage.book) ? "old" : "new"
|
|
101
|
+
let next = this.found[i + 1]
|
|
102
|
+
while (next && next.type === "integer" && next.start.b === result.end.b && next.end.c === result.start.c) {
|
|
103
|
+
passage.verses.push(next.start.v)
|
|
104
|
+
if (next.end.v !== next.start.v) passage.verses.push(next.end.v)
|
|
105
|
+
passage.subType = next.type
|
|
106
|
+
i++
|
|
107
|
+
next = this.found[i + 1]
|
|
108
|
+
}
|
|
109
|
+
if (passage.type === "range") {
|
|
110
|
+
if (result.start.c !== result.end.c) {
|
|
111
|
+
passage.verses = [result.start.v]
|
|
112
|
+
passage.to = {
|
|
113
|
+
book: this.bookify(result.end.b),
|
|
114
|
+
chapter: result.end.c,
|
|
115
|
+
verses: result.end.v,
|
|
132
116
|
}
|
|
133
117
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
118
|
+
}
|
|
119
|
+
passage.original = result.osis
|
|
120
|
+
passage.scripture = this.scripturize(passage)
|
|
121
|
+
passage.indices = result.indices
|
|
122
|
+
passage.entities = result.entities
|
|
123
|
+
if (passage.entities[0].translations) {
|
|
124
|
+
passage.version = {
|
|
125
|
+
name: passage.entities[0].translations[0].translation,
|
|
126
|
+
alias: passage.entities[0].translations[0].alias,
|
|
127
|
+
abbreviation: passage.entities[0].translations[0].osis,
|
|
144
128
|
}
|
|
145
|
-
this.passages.push(passage)
|
|
146
129
|
}
|
|
130
|
+
this.passages.push(passage)
|
|
147
131
|
}
|
|
148
|
-
this.passages.sort((a, b) => a.chapter - b.chapter)
|
|
149
132
|
this.found = []
|
|
150
133
|
return this
|
|
151
134
|
}
|