codexparser 0.1.64 → 0.1.65
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 +14 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codexparser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
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
|
@@ -227,6 +227,9 @@ class CodexParser {
|
|
|
227
227
|
parse(reference) {
|
|
228
228
|
this.scan(reference)
|
|
229
229
|
|
|
230
|
+
// Define non-abbreviated books per SBL/Crossway
|
|
231
|
+
const nonAbbreviatedBooks = ["John", "Luke", "Acts", "Jude", "James", "Titus"]
|
|
232
|
+
|
|
230
233
|
this.passages = this.found.map((passage) => {
|
|
231
234
|
const book = this.bookify(passage.book)
|
|
232
235
|
const testament = this.bible.old.includes(book) ? "old" : "new"
|
|
@@ -254,13 +257,20 @@ class CodexParser {
|
|
|
254
257
|
parsedPassage.scripture = this.scripturize(parsedPassage)
|
|
255
258
|
parsedPassage.valid = this._isValid(parsedPassage, passage.reference)
|
|
256
259
|
|
|
257
|
-
// Set abbr property using SBL-style
|
|
260
|
+
// Set abbr property using SBL-style rules
|
|
258
261
|
const abbrKey = Object.keys(this.abbreviations).find(
|
|
259
262
|
(abbr) => this.abbreviations[abbr].toLowerCase() === book.toLowerCase()
|
|
260
263
|
)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
:
|
|
264
|
+
if (nonAbbreviatedBooks.includes(book)) {
|
|
265
|
+
// Use full book name without period for non-abbreviated books
|
|
266
|
+
parsedPassage.abbr = `${book} ${passage.reference}${passage.version ? " " + passage.version : ""}`
|
|
267
|
+
} else if (abbrKey) {
|
|
268
|
+
// Use abbreviation with period for abbreviated books
|
|
269
|
+
parsedPassage.abbr = `${abbrKey}. ${passage.reference}${passage.version ? " " + passage.version : ""}`
|
|
270
|
+
} else {
|
|
271
|
+
// Fallback to original if no abbreviation (shouldn't occur with proper data)
|
|
272
|
+
parsedPassage.abbr = parsedPassage.original
|
|
273
|
+
}
|
|
264
274
|
|
|
265
275
|
if (parsedPassage.type === this.MULTI_CHAPTER_RANGE) {
|
|
266
276
|
this.handleMultiChapterRange(parsedPassage, passage.reference)
|