codexparser 0.1.21 → 0.1.23
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 +33 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
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
|
@@ -357,9 +357,7 @@ class CodexParser {
|
|
|
357
357
|
parsedPassage.scripture = this.scripturize(parsedPassage)
|
|
358
358
|
})
|
|
359
359
|
|
|
360
|
-
|
|
361
|
-
parsedPassage.valid = this._isValid(parsedPassage, passage.reference)
|
|
362
|
-
}
|
|
360
|
+
parsedPassage.valid = this._isValid(parsedPassage, passage.reference)
|
|
363
361
|
|
|
364
362
|
return parsedPassage
|
|
365
363
|
})
|
|
@@ -368,18 +366,41 @@ class CodexParser {
|
|
|
368
366
|
}
|
|
369
367
|
|
|
370
368
|
versification() {
|
|
371
|
-
|
|
372
|
-
const passage = this.passages[i]
|
|
369
|
+
this.passages.forEach((passage) => {
|
|
373
370
|
const hasVersification = this.versificationDifferences[passage.book]
|
|
374
|
-
|
|
375
|
-
|
|
371
|
+
|
|
372
|
+
passage.passages.forEach((subPassage) => {
|
|
373
|
+
// Apply general versification differences
|
|
376
374
|
if (hasVersification) {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
375
|
+
const key = `${subPassage.chapter}:${subPassage.verse}`
|
|
376
|
+
if (this.versificationDifferences[passage.book][key]) {
|
|
377
|
+
subPassage.versification = this.versificationDifferences[passage.book][key]
|
|
378
|
+
}
|
|
380
379
|
}
|
|
381
|
-
|
|
382
|
-
|
|
380
|
+
|
|
381
|
+
// Handle specific version adjustments for "lxx" or "mt"
|
|
382
|
+
if (passage.version) {
|
|
383
|
+
const versionAbbreviation = passage.version.abbreviation
|
|
384
|
+
const versionType =
|
|
385
|
+
versionAbbreviation === "lxx" ? "lxx" : versionAbbreviation === "mt" ? "mt" : null
|
|
386
|
+
|
|
387
|
+
if (versionType) {
|
|
388
|
+
const versionReference = `${subPassage.chapter}:${subPassage.verse}`
|
|
389
|
+
|
|
390
|
+
// Look for matching versification based on the version type (lxx or mt)
|
|
391
|
+
for (const versification in this.versificationDifferences[passage.book]) {
|
|
392
|
+
if (
|
|
393
|
+
this.versificationDifferences[passage.book][versification][versionType] ===
|
|
394
|
+
versionReference
|
|
395
|
+
) {
|
|
396
|
+
subPassage.versification = this.versificationDifferences[passage.book][versification]
|
|
397
|
+
break // Break once a match is found
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
})
|
|
403
|
+
})
|
|
383
404
|
}
|
|
384
405
|
|
|
385
406
|
/**
|