scripture-guide 1.0.15 → 1.0.16

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scripture-guide",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
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": "scriptures-compiled.js",
6
6
  "scripts": {
@@ -504,7 +504,7 @@ var detectReferences = function detectReferences(content, callBack) {
504
504
  return !blacklist_pattern.test(i);
505
505
  })) || [];
506
506
  matches = matches.map(function (i) {
507
- return i.replace(/[,;!?.]$/, "").trim();
507
+ return i.trim().replace(/[,;!?.]+/ig, "").trim();
508
508
  });
509
509
 
510
510
  //split by matches
package/scriptures.js CHANGED
@@ -487,8 +487,7 @@ const detectReferences = (content,callBack) => {
487
487
  const pattern = preparePattern(bookMatchList,wordBreak="",lang_extra);
488
488
  const blacklist_pattern = prepareBlacklist();
489
489
  var matches = content.match(pattern)?.filter(i=>!blacklist_pattern.test(i)) || [];
490
-
491
- matches = matches.map(i=>i.replace(/[,;!?.]$/,"").trim());
490
+ matches = matches.map(i => i.trim().replace(/[,;!?.]+/ig, "").trim());
492
491
 
493
492
  //split by matches
494
493
  const pieces = matches.length? content.split(new RegExp(`(${matches.join("|")})`, "ig")) : [content];
package/test-detect.js CHANGED
@@ -4,7 +4,8 @@ const {lookup, generateReference, setLanguage, detectReferences}= require("./scr
4
4
 
5
5
  const lines = [
6
6
  "Please refer to Genesis 20 in the bible",
7
- "Please refer to 3 Nephi 5:1-3 in the Book of Mormon"
7
+ "Please refer to 3 Nephi 5:1-3 in the Book of Mormon",
8
+ "For example, in Matthew 27:51, the earth quakes and ro"
8
9
  ]
9
10
 
10
11
  lines.forEach(l=>{
@@ -12,6 +13,8 @@ lines.forEach(l=>{
12
13
  console.log({result});
13
14
  });
14
15
 
16
+ process.exit(0);
17
+
15
18
  setLanguage("ko");
16
19
 
17
20
  const ko_lines = [
@@ -24,7 +27,6 @@ const ko_lines = [
24
27
  "이제 제4니파이서 4~5절 참조하십시오.",
25
28
  "이제 모세서 3장 참조하십시오.",
26
29
  "이제 참조하십시오.",
27
- "test this please"
28
30
  ]
29
31
  ko_lines.forEach(l=>{
30
32
  let callback = (string)=>{