tag-checker 0.0.100 → 0.0.103

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.100",
3
+ "version": "0.0.103",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/analyzeTag.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const volAnalyzeRegex = /<vol n="((\d+?)(-(\d+?))?)"/;
2
2
  const sutraRegex = /<sutra id="[\da-zA-Z]*?[a-zA-Z]((\d+?)([a-zA-Z])?)"/;
3
- const headAnalyzeRegex = /<head n="(\d+?)" (t|bo|tw|en|cn)="(.+?)"/;
3
+ const headAnalyzeRegex = /<head( n="(\d+?)"| (t|bo|tw|en|cn)="(.+?)")/;
4
4
  const bampoRegex = /<bampo n="((\d+?)([a-zA-Z])?)\.(\d+?)"/;
5
5
  const pb4AnalyzeRegex = /<pb id="((\d+?)(-(\d+?))?)-((\d+?)([abcd]))"/;
6
6
  const pbAnalyzeRegex = /<pb id="((\d+?)(-(\d+?))?)-(\d+?)"/;
@@ -31,13 +31,14 @@ export function analyzeSutra(fn, pb, tag) {
31
31
 
32
32
  export function analyzeHead(fn, pb, tag) {
33
33
  let headBio = headAnalyzeRegex.exec(tag);
34
+
34
35
  return {
35
36
  type: 'head',
36
37
  fn: fn,
37
38
  pb: pb,
38
39
  tag: headBio[0],
39
- headN: Number(headBio[1]),
40
- tName: headBio[2]
40
+ headN: Number(headBio[2]),
41
+ tName: headBio[4]
41
42
  };
42
43
  }
43
44
 
@@ -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|mp|sutra|bampo|headnote|\/?question_mark|\/?stitle|\/?ttitle|\/?small|d|pedurma|note|\/?s|V|L|D|M|\/?p|\/?pronunciationMeaning|WB|g|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|\/?p|\/?pm|WB|g|graphic|\/?voltext)).+/g;
10
10
 
11
11
  export default function checkTagFormat(textObjs, pbWithSuffix, looseMode) {
12
12
  let errMessages = [];
@@ -88,7 +88,7 @@ let tagRules = [
88
88
  },
89
89
  {
90
90
  type: 'head',
91
- correctRegex: /<head (?=[^>]*?n="\d+?")(?=[^>]*?(t|type|zh|lv|st|ct|tid|sff|bo|en|tw|cn)="[^"<>\n]*?")+?\/>/g,
91
+ correctRegex: /<head( n="\d+?"| (t|type|zh|lv|st|ct|tid|sff|bo|en|tw|cn)="[^"<>\n]*?")+?\/>/g,
92
92
  suspectedRegex: /<head /g,
93
93
  tagNameStrRegex: /head(?!note)/g,
94
94
  lineWithTagRegex: /^.*?head.*$/mg