scripture-guide 1.0.95 → 1.0.97
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/dist/scriptures.cjs +29 -4
- package/dist/scriptures.mjs +29 -4
- package/package.json +1 -1
package/dist/scriptures.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* scripture-guide v1.0.
|
|
1
|
+
/* scripture-guide v1.0.97 */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -3249,6 +3249,16 @@ var en_default3 = {
|
|
|
3249
3249
|
"cited at",
|
|
3250
3250
|
"also"
|
|
3251
3251
|
],
|
|
3252
|
+
"capitalized_only": [
|
|
3253
|
+
"is",
|
|
3254
|
+
"am",
|
|
3255
|
+
"he",
|
|
3256
|
+
"re",
|
|
3257
|
+
"la",
|
|
3258
|
+
"co",
|
|
3259
|
+
"col",
|
|
3260
|
+
"act"
|
|
3261
|
+
],
|
|
3252
3262
|
"pre_rules": [
|
|
3253
3263
|
[
|
|
3254
3264
|
"\\bgospel\\s+(?:of|according\\s+to)\\s+",
|
|
@@ -3310,6 +3320,10 @@ var en_default3 = {
|
|
|
3310
3320
|
"\\bfourth\\s+(?=[A-Za-z])",
|
|
3311
3321
|
"4 "
|
|
3312
3322
|
],
|
|
3323
|
+
[
|
|
3324
|
+
"(\\d)\\s+&\\s+",
|
|
3325
|
+
"$1; "
|
|
3326
|
+
],
|
|
3313
3327
|
[
|
|
3314
3328
|
"[.]{2,}",
|
|
3315
3329
|
";"
|
|
@@ -31294,7 +31308,8 @@ function buildRegexData() {
|
|
|
31294
31308
|
books,
|
|
31295
31309
|
pre_rules: en_default3.pre_rules || [],
|
|
31296
31310
|
post_rules: en_default3.post_rules || [],
|
|
31297
|
-
joiners: en_default3.joiners || []
|
|
31311
|
+
joiners: en_default3.joiners || [],
|
|
31312
|
+
capitalized_only: en_default3.capitalized_only || []
|
|
31298
31313
|
};
|
|
31299
31314
|
}
|
|
31300
31315
|
function transformBooks(bibleBooks, ldsBooks) {
|
|
@@ -31543,7 +31558,7 @@ var mergeAdjacentMatches = (matches, gapMergeFlags, compatibilityCheck = null) =
|
|
|
31543
31558
|
if (prevIndex.length > 2 && current.length > 2) {
|
|
31544
31559
|
const startPos = prevIndex[0];
|
|
31545
31560
|
const endPos = current[1];
|
|
31546
|
-
const combinedText = prevIndex[2] + ";" + current[2];
|
|
31561
|
+
const combinedText = prevIndex[2] + "; " + current[2];
|
|
31547
31562
|
const combinedVerseIds = [...prevIndex[3] || [], ...current[3] || []];
|
|
31548
31563
|
const merged = [startPos, endPos, combinedText, combinedVerseIds];
|
|
31549
31564
|
prev[prev.length - 1] = merged;
|
|
@@ -31621,6 +31636,9 @@ var findMatches = (content, books, lang_extra) => {
|
|
|
31621
31636
|
const gap = "[ \\t]*(?:\\n(?![ \\t]*\\n)[ \\t]*)?(?:,[ \\t]*sec(?:tion)?\\.?[ \\t]*)?\\(?[ \\t]*(?=[0-9])";
|
|
31622
31637
|
const core = "(?:[0-9:.;,~\u2014\u2013-]|[ \\t]|\\n(?![ \\t]*\\n)|and\\b|cf\\b|\\()*[0-9]";
|
|
31623
31638
|
const postBookMatch = lang_extra.chapter || gap + core;
|
|
31639
|
+
const capitalizedOnlyAbbreviations = new Set(
|
|
31640
|
+
(lang_extra.capitalizedOnly || []).map((i) => String(i).toLowerCase())
|
|
31641
|
+
);
|
|
31624
31642
|
const fullBookMatches = matchingBooks.map((bookMatch) => {
|
|
31625
31643
|
const patternString = preBookMatch + bookMatch;
|
|
31626
31644
|
const pattern = new RegExp(patternString, "ig");
|
|
@@ -31633,7 +31651,11 @@ var findMatches = (content, books, lang_extra) => {
|
|
|
31633
31651
|
}).flat().reduce((prev, current) => {
|
|
31634
31652
|
if (prev.includes(current)) return prev;
|
|
31635
31653
|
return [...prev, current];
|
|
31636
|
-
}, []).filter((i) => !!i).
|
|
31654
|
+
}, []).filter((i) => !!i).filter((substring) => {
|
|
31655
|
+
const token = substring.trim();
|
|
31656
|
+
if (!capitalizedOnlyAbbreviations.has(token.toLowerCase())) return true;
|
|
31657
|
+
return token !== token.toLowerCase();
|
|
31658
|
+
}).map((substring) => {
|
|
31637
31659
|
substring = substring.trim();
|
|
31638
31660
|
let positions = [];
|
|
31639
31661
|
let index = normalizedContent.indexOf(substring);
|
|
@@ -31666,6 +31688,7 @@ var findMatches = (content, books, lang_extra) => {
|
|
|
31666
31688
|
const len = match.length;
|
|
31667
31689
|
const pos = i;
|
|
31668
31690
|
const [posIn, posOut] = [pos, pos + len];
|
|
31691
|
+
if (/[0-9]$/.test(match) && /[A-Z]/.test(normalizedContent[posOut] || "")) return null;
|
|
31669
31692
|
return [match, posIn, posOut];
|
|
31670
31693
|
}
|
|
31671
31694
|
);
|
|
@@ -31708,6 +31731,7 @@ function findMatchIndexes(content, matches, lookupReference2, lang_extra) {
|
|
|
31708
31731
|
const next = array[index + 1];
|
|
31709
31732
|
if (next && next[0] < end && next[1] > end) {
|
|
31710
31733
|
end = next[0];
|
|
31734
|
+
end = start + content.slice(start, end).replace(tail, "").length;
|
|
31711
31735
|
}
|
|
31712
31736
|
return [start, end];
|
|
31713
31737
|
});
|
|
@@ -32752,6 +32776,7 @@ var getLanguageConfig = function(language, canon = null) {
|
|
|
32752
32776
|
};
|
|
32753
32777
|
if (effectiveLanguage === "en" || !raw_lang[effectiveLanguage]) {
|
|
32754
32778
|
config.lang_extra.joiners = config.raw_regex.joiners;
|
|
32779
|
+
config.lang_extra.capitalizedOnly = config.raw_regex.capitalized_only || [];
|
|
32755
32780
|
return applyCanonOverride(config, effectiveCanon);
|
|
32756
32781
|
}
|
|
32757
32782
|
const langData2 = raw_lang[effectiveLanguage];
|
package/dist/scriptures.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* scripture-guide v1.0.
|
|
1
|
+
/* scripture-guide v1.0.97 */
|
|
2
2
|
|
|
3
3
|
// src/data/canons/bible/structure.mjs
|
|
4
4
|
var structure_default = {
|
|
@@ -3200,6 +3200,16 @@ var en_default3 = {
|
|
|
3200
3200
|
"cited at",
|
|
3201
3201
|
"also"
|
|
3202
3202
|
],
|
|
3203
|
+
"capitalized_only": [
|
|
3204
|
+
"is",
|
|
3205
|
+
"am",
|
|
3206
|
+
"he",
|
|
3207
|
+
"re",
|
|
3208
|
+
"la",
|
|
3209
|
+
"co",
|
|
3210
|
+
"col",
|
|
3211
|
+
"act"
|
|
3212
|
+
],
|
|
3203
3213
|
"pre_rules": [
|
|
3204
3214
|
[
|
|
3205
3215
|
"\\bgospel\\s+(?:of|according\\s+to)\\s+",
|
|
@@ -3261,6 +3271,10 @@ var en_default3 = {
|
|
|
3261
3271
|
"\\bfourth\\s+(?=[A-Za-z])",
|
|
3262
3272
|
"4 "
|
|
3263
3273
|
],
|
|
3274
|
+
[
|
|
3275
|
+
"(\\d)\\s+&\\s+",
|
|
3276
|
+
"$1; "
|
|
3277
|
+
],
|
|
3264
3278
|
[
|
|
3265
3279
|
"[.]{2,}",
|
|
3266
3280
|
";"
|
|
@@ -31245,7 +31259,8 @@ function buildRegexData() {
|
|
|
31245
31259
|
books,
|
|
31246
31260
|
pre_rules: en_default3.pre_rules || [],
|
|
31247
31261
|
post_rules: en_default3.post_rules || [],
|
|
31248
|
-
joiners: en_default3.joiners || []
|
|
31262
|
+
joiners: en_default3.joiners || [],
|
|
31263
|
+
capitalized_only: en_default3.capitalized_only || []
|
|
31249
31264
|
};
|
|
31250
31265
|
}
|
|
31251
31266
|
function transformBooks(bibleBooks, ldsBooks) {
|
|
@@ -31494,7 +31509,7 @@ var mergeAdjacentMatches = (matches, gapMergeFlags, compatibilityCheck = null) =
|
|
|
31494
31509
|
if (prevIndex.length > 2 && current.length > 2) {
|
|
31495
31510
|
const startPos = prevIndex[0];
|
|
31496
31511
|
const endPos = current[1];
|
|
31497
|
-
const combinedText = prevIndex[2] + ";" + current[2];
|
|
31512
|
+
const combinedText = prevIndex[2] + "; " + current[2];
|
|
31498
31513
|
const combinedVerseIds = [...prevIndex[3] || [], ...current[3] || []];
|
|
31499
31514
|
const merged = [startPos, endPos, combinedText, combinedVerseIds];
|
|
31500
31515
|
prev[prev.length - 1] = merged;
|
|
@@ -31572,6 +31587,9 @@ var findMatches = (content, books, lang_extra) => {
|
|
|
31572
31587
|
const gap = "[ \\t]*(?:\\n(?![ \\t]*\\n)[ \\t]*)?(?:,[ \\t]*sec(?:tion)?\\.?[ \\t]*)?\\(?[ \\t]*(?=[0-9])";
|
|
31573
31588
|
const core = "(?:[0-9:.;,~\u2014\u2013-]|[ \\t]|\\n(?![ \\t]*\\n)|and\\b|cf\\b|\\()*[0-9]";
|
|
31574
31589
|
const postBookMatch = lang_extra.chapter || gap + core;
|
|
31590
|
+
const capitalizedOnlyAbbreviations = new Set(
|
|
31591
|
+
(lang_extra.capitalizedOnly || []).map((i) => String(i).toLowerCase())
|
|
31592
|
+
);
|
|
31575
31593
|
const fullBookMatches = matchingBooks.map((bookMatch) => {
|
|
31576
31594
|
const patternString = preBookMatch + bookMatch;
|
|
31577
31595
|
const pattern = new RegExp(patternString, "ig");
|
|
@@ -31584,7 +31602,11 @@ var findMatches = (content, books, lang_extra) => {
|
|
|
31584
31602
|
}).flat().reduce((prev, current) => {
|
|
31585
31603
|
if (prev.includes(current)) return prev;
|
|
31586
31604
|
return [...prev, current];
|
|
31587
|
-
}, []).filter((i) => !!i).
|
|
31605
|
+
}, []).filter((i) => !!i).filter((substring) => {
|
|
31606
|
+
const token = substring.trim();
|
|
31607
|
+
if (!capitalizedOnlyAbbreviations.has(token.toLowerCase())) return true;
|
|
31608
|
+
return token !== token.toLowerCase();
|
|
31609
|
+
}).map((substring) => {
|
|
31588
31610
|
substring = substring.trim();
|
|
31589
31611
|
let positions = [];
|
|
31590
31612
|
let index = normalizedContent.indexOf(substring);
|
|
@@ -31617,6 +31639,7 @@ var findMatches = (content, books, lang_extra) => {
|
|
|
31617
31639
|
const len = match.length;
|
|
31618
31640
|
const pos = i;
|
|
31619
31641
|
const [posIn, posOut] = [pos, pos + len];
|
|
31642
|
+
if (/[0-9]$/.test(match) && /[A-Z]/.test(normalizedContent[posOut] || "")) return null;
|
|
31620
31643
|
return [match, posIn, posOut];
|
|
31621
31644
|
}
|
|
31622
31645
|
);
|
|
@@ -31659,6 +31682,7 @@ function findMatchIndexes(content, matches, lookupReference2, lang_extra) {
|
|
|
31659
31682
|
const next = array[index + 1];
|
|
31660
31683
|
if (next && next[0] < end && next[1] > end) {
|
|
31661
31684
|
end = next[0];
|
|
31685
|
+
end = start + content.slice(start, end).replace(tail, "").length;
|
|
31662
31686
|
}
|
|
31663
31687
|
return [start, end];
|
|
31664
31688
|
});
|
|
@@ -32703,6 +32727,7 @@ var getLanguageConfig = function(language, canon = null) {
|
|
|
32703
32727
|
};
|
|
32704
32728
|
if (effectiveLanguage === "en" || !raw_lang[effectiveLanguage]) {
|
|
32705
32729
|
config.lang_extra.joiners = config.raw_regex.joiners;
|
|
32730
|
+
config.lang_extra.capitalizedOnly = config.raw_regex.capitalized_only || [];
|
|
32706
32731
|
return applyCanonOverride(config, effectiveCanon);
|
|
32707
32732
|
}
|
|
32708
32733
|
const langData2 = raw_lang[effectiveLanguage];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scripture-guide",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.97",
|
|
4
4
|
"description": "A utility for biblical and scripture reference parsing that enables structured queries based on strings of traditional scripture references (e.g. John 3:16). ",
|
|
5
5
|
"main": "dist/scriptures.cjs",
|
|
6
6
|
"module": "dist/scriptures.mjs",
|