tag-checker 0.0.86 → 0.0.90

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": "tag-checker",
3
- "version": "0.0.86",
3
+ "version": "0.0.90",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/analyzeTag.js CHANGED
@@ -2,8 +2,8 @@ const volAnalyzeRegex = /<vol n="((\d+?)(-(\d+?))?)"/;
2
2
  const sutraRegex = /<sutra id="[\da-zA-Z]*?[a-zA-Z]((\d+?)([a-zA-Z])?)"/;
3
3
  const headAnalyzeRegex = /<head n="(\d+?)" (t|bo|tw|en|cn)="(.+?)"/;
4
4
  const bampoRegex = /<bampo n="((\d+?)([a-zA-Z])?)\.(\d+?)"/;
5
- const pb4AnalyzeRegex = /<pb id="((\d+?)-?(\d+?)?)-((\d+?)([abcd]))"/;
6
- const pbAnalyzeRegex = /<pb id="((\d+?)-?(\d+?)?)-(\d+?)"/;
5
+ const pb4AnalyzeRegex = /<pb id="((\d+?)(-(\d+?))?)-((\d+?)([abcd]))"/;
6
+ const pbAnalyzeRegex = /<pb id="((\d+?)(-(\d+?))?)-(\d+?)"/;
7
7
 
8
8
  export function analyzeVol(fn, tagStr) {
9
9
  let volBio = volAnalyzeRegex.exec(tagStr);
@@ -14,7 +14,7 @@ export function analyzeVol(fn, tagStr) {
14
14
  vol1n: Number(volBio[2]),
15
15
  vol2n: Number(volBio[4])
16
16
  };
17
- };
17
+ }
18
18
 
19
19
  export function analyzeSutra(fn, pb, tag) {
20
20
  let sutraBio = sutraRegex.exec(tag);
@@ -27,7 +27,7 @@ export function analyzeSutra(fn, pb, tag) {
27
27
  sutraN: Number(sutraBio[2]),
28
28
  sutraL: sutraBio[3]
29
29
  }
30
- };
30
+ }
31
31
 
32
32
  export function analyzeHead(fn, pb, tag) {
33
33
  let headBio = headAnalyzeRegex.exec(tag);
@@ -39,7 +39,7 @@ export function analyzeHead(fn, pb, tag) {
39
39
  headN: Number(headBio[1]),
40
40
  tName: headBio[2]
41
41
  };
42
- };
42
+ }
43
43
 
44
44
  export function analyzeBampo(fn, pb, tag) {
45
45
  let bampoBio = bampoRegex.exec(tag);
@@ -53,7 +53,7 @@ export function analyzeBampo(fn, pb, tag) {
53
53
  sutraL: bampoBio[3],
54
54
  bampoN: Number(bampoBio[4])
55
55
  };
56
- };
56
+ }
57
57
 
58
58
  export function analyzePb4(fn, tagStr) {
59
59
  let pb4Bio = pb4AnalyzeRegex.exec(tagStr);
@@ -62,12 +62,12 @@ export function analyzePb4(fn, tagStr) {
62
62
  tag: pb4Bio[0],
63
63
  pbVolN: pb4Bio[1],
64
64
  pbVol1n: Number(pb4Bio[2]),
65
- pbVol2n: pb4Bio[3] ? Number(pb4Bio[3]) : 1,
66
- pbNL: pb4Bio[4],
67
- pbN: Number(pb4Bio[5]),
68
- pbL: pb4Bio[6]
65
+ pbVol2n: pb4Bio[4] ? Number(pb4Bio[4]) : 1,
66
+ pbNL: pb4Bio[5],
67
+ pbN: Number(pb4Bio[6]),
68
+ pbL: pb4Bio[7]
69
69
  };
70
- };
70
+ }
71
71
 
72
72
  export function analyzePb(fn, tagStr) {
73
73
  let pbBio = pbAnalyzeRegex.exec(tagStr);
@@ -76,7 +76,7 @@ export function analyzePb(fn, tagStr) {
76
76
  tag: pbBio[0],
77
77
  pbVolN: pbBio[1],
78
78
  pbVol1n: Number(pbBio[2]),
79
- pbVol2n: pbBio[3] ? Number(pbBio[3]) : 1,
80
- pbN: Number(pbBio[4])
79
+ pbVol2n: pbBio[4] ? Number(pbBio[4]) : 1,
80
+ pbN: Number(pbBio[5])
81
81
  };
82
- };
82
+ }
@@ -35,7 +35,7 @@ export default function checkPbOrder(textObjs, pbWithSuffix) {
35
35
  });
36
36
 
37
37
  reportErr('Wrong Pb Order!', errMessages);
38
- };
38
+ }
39
39
 
40
40
  function init(textObj, pbWithSuffix) {
41
41
  let {fn, text} = textObj;
@@ -98,15 +98,17 @@ function pbIs1st(pbId) {
98
98
  function setVariables(textObj, textsVol1n, pbAnalyzer) {
99
99
  let {fn, text} = textObj;
100
100
  let volInText = volExist(text);
101
+ let textVol1n;
101
102
  if (volInText) {
102
103
  var volBio = analyzeVol(fn, text);
103
- var textVol1n = volBio.vol1n;
104
+ textVol1n = volBio.vol1n;
104
105
  }
105
106
  else if (textsVol1n) {
106
- var textVol1n = textsVol1n;
107
+ textVol1n = textsVol1n;
107
108
  }
108
109
  else {
109
- var {pbVol1n: textVol1n} = pbAnalyzer(fn, text);
110
+ let { pbVol1n } = pbAnalyzer(fn, text);
111
+ textVol1n = pbVol1n;
110
112
  }
111
113
  return [fn, text, volInText, volBio, textVol1n];
112
114
  }
@@ -6,7 +6,7 @@ import {sameNumber} from './compareNumber.js';
6
6
  const emptyTagRegex = /<[\s\/]*>/g;
7
7
  const noEndArrowRegex = /<[^>]*?(<|\n|$)/g;
8
8
  const noStartArrowRegex = /(^|\n|>)[^<\n]*?>/g;
9
- const undefinedTagRegex = /<(?!(division|vol|head|pb|jp|sutra|bampo|headnote|\/?stitle|\/?ttitle|\/?small|d|pedurma|note|\/?s|V|L|D|M|WB|graphic|\/?voltext)).+/g;
9
+ const undefinedTagRegex = /<(?!(division|vol|head|pb|jp|mp|sutra|bampo|headnote|\/?question_mark|\/?stitle|\/?ttitle|\/?small|d|pedurma|note|\/?s|V|L|D|M|WB|g|graphic|\/?voltext)).+/g;
10
10
 
11
11
  export default function checkTagFormat(textObjs, pbWithSuffix, looseMode) {
12
12
  let errMessages = [];