codexparser 0.0.65 → 0.0.68
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 +37 -47
- 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.68",
|
|
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,53 @@ 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
|
-
book: this.bookify(result.start.b),
|
|
111
|
-
chapter: result.start.c,
|
|
112
|
-
verses: this.versify(result),
|
|
113
|
-
type: result.type,
|
|
114
|
-
}
|
|
115
|
-
passage.testament = this.bible.old.includes(passage.book) ? "old" : "new"
|
|
116
|
-
let next = results[j + 1]
|
|
117
|
-
while (next && next.type === "integer" && next.end.c === result.start.c) {
|
|
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
|
+
if (next && next.type === "integer" && next.start.b === result.end.b && next.end.c === result.start.c) {
|
|
103
|
+
while (
|
|
104
|
+
next &&
|
|
105
|
+
next.type === "integer" &&
|
|
106
|
+
next.start.b === result.end.b &&
|
|
107
|
+
next.end.c === result.start.c
|
|
108
|
+
) {
|
|
118
109
|
passage.verses.push(next.start.v)
|
|
119
110
|
if (next.end.v !== next.start.v) passage.verses.push(next.end.v)
|
|
120
111
|
passage.subType = next.type
|
|
121
|
-
|
|
122
|
-
next =
|
|
112
|
+
i++
|
|
113
|
+
next = this.found[i + 1]
|
|
123
114
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
115
|
+
}
|
|
116
|
+
if (passage.type === "range") {
|
|
117
|
+
if (result.start.c !== result.end.c) {
|
|
118
|
+
passage.verses = [result.start.v]
|
|
119
|
+
passage.to = {
|
|
120
|
+
book: this.bookify(result.end.b),
|
|
121
|
+
chapter: result.end.c,
|
|
122
|
+
verses: result.end.v,
|
|
132
123
|
}
|
|
133
124
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
125
|
+
}
|
|
126
|
+
passage.original = result.osis
|
|
127
|
+
passage.scripture = this.scripturize(passage)
|
|
128
|
+
passage.indices = result.indices
|
|
129
|
+
passage.entities = result.entities
|
|
130
|
+
if (passage.entities[0].translations) {
|
|
131
|
+
passage.version = {
|
|
132
|
+
name: passage.entities[0].translations[0].translation,
|
|
133
|
+
alias: passage.entities[0].translations[0].alias,
|
|
134
|
+
abbreviation: passage.entities[0].translations[0].osis,
|
|
144
135
|
}
|
|
145
|
-
this.passages.push(passage)
|
|
146
136
|
}
|
|
137
|
+
this.passages.push(passage)
|
|
147
138
|
}
|
|
148
|
-
this.passages.sort((a, b) => a.chapter - b.chapter)
|
|
149
139
|
this.found = []
|
|
150
140
|
return this
|
|
151
141
|
}
|