@digipair/skill-docxtemplater 0.42.0 → 0.43.2

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/index.cjs.js CHANGED
@@ -6860,8 +6860,21 @@ function getDelimiterErrors(delimiterMatches, fullText, syntaxOptions) {
6860
6860
  if (inDelimiter && position === "start") {
6861
6861
  if (lastDelimiterOffset + lastDelimiterLength === delimiterOffset) {
6862
6862
  xtag = fullText.substr(lastDelimiterOffset, delimiterOffset - lastDelimiterOffset + lastDelimiterLength + 4);
6863
- errors.push(getDuplicateOpenTagException({
6864
- xtag: xtag,
6863
+ if (!syntaxOptions.allowUnclosedTag) {
6864
+ errors.push(getDuplicateOpenTagException({
6865
+ xtag: xtag,
6866
+ offset: lastDelimiterOffset
6867
+ }));
6868
+ lastDelimiterMatch = currDelimiterMatch;
6869
+ delimiterAcc.push(_objectSpread$3(_objectSpread$3({}, currDelimiterMatch), {}, {
6870
+ error: true
6871
+ }));
6872
+ return delimiterAcc;
6873
+ }
6874
+ }
6875
+ if (!syntaxOptions.allowUnclosedTag) {
6876
+ errors.push(getUnclosedTagException({
6877
+ xtag: wordToUtf8$2(xtag),
6865
6878
  offset: lastDelimiterOffset
6866
6879
  }));
6867
6880
  lastDelimiterMatch = currDelimiterMatch;
@@ -6870,15 +6883,7 @@ function getDelimiterErrors(delimiterMatches, fullText, syntaxOptions) {
6870
6883
  }));
6871
6884
  return delimiterAcc;
6872
6885
  }
6873
- errors.push(getUnclosedTagException({
6874
- xtag: wordToUtf8$2(xtag),
6875
- offset: lastDelimiterOffset
6876
- }));
6877
- lastDelimiterMatch = currDelimiterMatch;
6878
- delimiterAcc.push(_objectSpread$3(_objectSpread$3({}, currDelimiterMatch), {}, {
6879
- error: true
6880
- }));
6881
- return delimiterAcc;
6886
+ delimiterAcc.pop();
6882
6887
  }
6883
6888
  if (!inDelimiter && position === "end") {
6884
6889
  if (syntaxOptions.allowUnopenedTag) {
@@ -6906,7 +6911,7 @@ function getDelimiterErrors(delimiterMatches, fullText, syntaxOptions) {
6906
6911
  }));
6907
6912
  return delimiterAcc;
6908
6913
  }
6909
- inDelimiter = !inDelimiter;
6914
+ inDelimiter = position === "start";
6910
6915
  lastDelimiterMatch = currDelimiterMatch;
6911
6916
  delimiterAcc.push(currDelimiterMatch);
6912
6917
  return delimiterAcc;
@@ -6914,10 +6919,14 @@ function getDelimiterErrors(delimiterMatches, fullText, syntaxOptions) {
6914
6919
  if (inDelimiter) {
6915
6920
  var lastDelimiterOffset = lastDelimiterMatch.offset;
6916
6921
  xtag = fullText.substr(lastDelimiterOffset, fullText.length - lastDelimiterOffset);
6917
- errors.push(getUnclosedTagException({
6918
- xtag: wordToUtf8$2(xtag),
6919
- offset: lastDelimiterOffset
6920
- }));
6922
+ if (!syntaxOptions.allowUnclosedTag) {
6923
+ errors.push(getUnclosedTagException({
6924
+ xtag: wordToUtf8$2(xtag),
6925
+ offset: lastDelimiterOffset
6926
+ }));
6927
+ } else {
6928
+ delimiterWithErrors.pop();
6929
+ }
6921
6930
  }
6922
6931
  return {
6923
6932
  delimiterWithErrors: delimiterWithErrors,
package/index.esm.js CHANGED
@@ -6856,8 +6856,21 @@ function getDelimiterErrors(delimiterMatches, fullText, syntaxOptions) {
6856
6856
  if (inDelimiter && position === "start") {
6857
6857
  if (lastDelimiterOffset + lastDelimiterLength === delimiterOffset) {
6858
6858
  xtag = fullText.substr(lastDelimiterOffset, delimiterOffset - lastDelimiterOffset + lastDelimiterLength + 4);
6859
- errors.push(getDuplicateOpenTagException({
6860
- xtag: xtag,
6859
+ if (!syntaxOptions.allowUnclosedTag) {
6860
+ errors.push(getDuplicateOpenTagException({
6861
+ xtag: xtag,
6862
+ offset: lastDelimiterOffset
6863
+ }));
6864
+ lastDelimiterMatch = currDelimiterMatch;
6865
+ delimiterAcc.push(_objectSpread$3(_objectSpread$3({}, currDelimiterMatch), {}, {
6866
+ error: true
6867
+ }));
6868
+ return delimiterAcc;
6869
+ }
6870
+ }
6871
+ if (!syntaxOptions.allowUnclosedTag) {
6872
+ errors.push(getUnclosedTagException({
6873
+ xtag: wordToUtf8$2(xtag),
6861
6874
  offset: lastDelimiterOffset
6862
6875
  }));
6863
6876
  lastDelimiterMatch = currDelimiterMatch;
@@ -6866,15 +6879,7 @@ function getDelimiterErrors(delimiterMatches, fullText, syntaxOptions) {
6866
6879
  }));
6867
6880
  return delimiterAcc;
6868
6881
  }
6869
- errors.push(getUnclosedTagException({
6870
- xtag: wordToUtf8$2(xtag),
6871
- offset: lastDelimiterOffset
6872
- }));
6873
- lastDelimiterMatch = currDelimiterMatch;
6874
- delimiterAcc.push(_objectSpread$3(_objectSpread$3({}, currDelimiterMatch), {}, {
6875
- error: true
6876
- }));
6877
- return delimiterAcc;
6882
+ delimiterAcc.pop();
6878
6883
  }
6879
6884
  if (!inDelimiter && position === "end") {
6880
6885
  if (syntaxOptions.allowUnopenedTag) {
@@ -6902,7 +6907,7 @@ function getDelimiterErrors(delimiterMatches, fullText, syntaxOptions) {
6902
6907
  }));
6903
6908
  return delimiterAcc;
6904
6909
  }
6905
- inDelimiter = !inDelimiter;
6910
+ inDelimiter = position === "start";
6906
6911
  lastDelimiterMatch = currDelimiterMatch;
6907
6912
  delimiterAcc.push(currDelimiterMatch);
6908
6913
  return delimiterAcc;
@@ -6910,10 +6915,14 @@ function getDelimiterErrors(delimiterMatches, fullText, syntaxOptions) {
6910
6915
  if (inDelimiter) {
6911
6916
  var lastDelimiterOffset = lastDelimiterMatch.offset;
6912
6917
  xtag = fullText.substr(lastDelimiterOffset, fullText.length - lastDelimiterOffset);
6913
- errors.push(getUnclosedTagException({
6914
- xtag: wordToUtf8$2(xtag),
6915
- offset: lastDelimiterOffset
6916
- }));
6918
+ if (!syntaxOptions.allowUnclosedTag) {
6919
+ errors.push(getUnclosedTagException({
6920
+ xtag: wordToUtf8$2(xtag),
6921
+ offset: lastDelimiterOffset
6922
+ }));
6923
+ } else {
6924
+ delimiterWithErrors.pop();
6925
+ }
6917
6926
  }
6918
6927
  return {
6919
6928
  delimiterWithErrors: delimiterWithErrors,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-docxtemplater",
3
- "version": "0.42.0",
3
+ "version": "0.43.2",
4
4
  "dependencies": {},
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js"