twl-generator 1.3.4 → 1.3.6

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +5 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twl-generator",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Generate term-to-article lists from unfoldingWord en_tw archive for Bible books. Works in both Node.js (CLI) and React.js (browser) environments.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -59,4 +59,4 @@
59
59
  "optional": true
60
60
  }
61
61
  }
62
- }
62
+ }
package/src/index.js CHANGED
@@ -512,10 +512,9 @@ function findMatchingArticles(glq, articlesList, termMap, opts = {}) {
512
512
  const termOrig = tobj.orig;
513
513
  if (termOrig) {
514
514
  // Match if the term appears:
515
- // - At word boundary (beginning or end of string, or after/before whitespace or punctuation)
516
- // - After any type of dash (—, –, -)
517
- // This regex ensures we don't match inside other words like "fromever" matching "Rome"
518
- const re3 = new RegExp(`(?:^|\\b|[—–-])${escapeRegExp(termOrig)}(?=\\b|$|[—–-])`, '');
515
+ // - At word boundary (beginning of word or after dash)
516
+ // - Allow substring matching (e.g., "reap" matches "reapers")
517
+ const re3 = new RegExp(`(?:^|\\b|[—–-])${escapeRegExp(termOrig)}`, '');
519
518
  if (re3.test(textOrig)) { stage = 3; termHit = termOrig; break; }
520
519
  }
521
520
  }
@@ -592,7 +591,8 @@ function findMatchingArticles(glq, articlesList, termMap, opts = {}) {
592
591
  }
593
592
  } else {
594
593
  // For non-stripped forms, match at word boundaries or after dashes (case-insensitive)
595
- const regex4 = new RegExp(`(?:^|\\b|[—–-])${escapeRegExp(form)}(?=\\b|$|[—–-])`, 'i');
594
+ // Allow substring matching (e.g., "reap" matches "reapers")
595
+ const regex4 = new RegExp(`(?:^|\\b|[—–-])${escapeRegExp(form)}`, 'i');
596
596
  if (regex4.test(textOrig)) {
597
597
  stage = 4;
598
598
  termHit = termOrig;