diff --git a/README.md b/README.md
index 782e70c..d512dcd 100755
--- a/README.md
+++ b/README.md
@@ -161,6 +161,14 @@ const report = await createReport({
* (Default: 1)
*/
compressionLevel?: number;
+ /**
+ * Whether to allow nested IF commands within the same paragraph or table row.
+ * By default, the library throws an error when it detects an IF command
+ * nested within another IF command on the same line or table row.
+ * Set to true to skip this validation check.
+ * (Default: false)
+ */
+ allowNestedIf?: boolean;
});
```
diff --git a/src/__tests__/__snapshots__/templating.test.ts.snap b/src/__tests__/__snapshots__/templating.test.ts.snap
index 35880f0..da99845 100644
--- a/src/__tests__/__snapshots__/templating.test.ts.snap
+++ b/src/__tests__/__snapshots__/templating.test.ts.snap
@@ -27894,6 +27894,976 @@ exports[`noSandbox Template processing INS in header and footer 1`] = `
exports[`noSandbox Template processing Nested IF statements on same line 1`] = `[Error: Invalid IF command nested into another IF command on the same line: IF b]`;
+exports[`noSandbox Template processing Nested IF statements on same line with allowNestedIf: true 1`] = `
+"
+
+
+
+
+
+
+
+
+
+
+
+
+ This line should be displayed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+ text
+
+
+
+
+
+ should be visible
+
+
+
+
+
+ ,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This should also be visible in the same line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This line should be displayed
+
+
+
+
+
+ in a loop
+
+
+
+
+
+
+
+
+
+
+
+
+ This line should be displayed
+
+
+
+
+
+ in a loop
+
+
+
+
+
+
+
+
+
+
+
+
+ This line should be displayed
+
+
+
+
+
+ in a loop
+
+
+
+
+
+
+
+
+
+
+
+
+ This line should be displayed
+
+
+
+
+
+ in a loop
+
+
+
+
+
+
+
+
+
+
+
+
+ This line should be displayed
+
+
+
+
+
+ in a loop
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+
+ line should be displayed in a loop
+
+
+
+
+
+ in same line,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+
+ line should be displayed in a loop
+
+
+
+
+
+ in same line,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+
+ line should be displayed in a loop
+
+
+
+
+
+ in same line,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+
+ line should be displayed in a loop
+
+
+
+
+
+ in same line,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+
+ line should be displayed in a loop
+
+
+
+
+
+ in same line,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"
+`;
+
exports[`noSandbox Template processing Nested IF statements on same row1 1`] = `[Error: Invalid IF command nested into another IF command on the same table row: IF b]`;
exports[`noSandbox Template processing Nested IF statements on same row2 1`] = `[Error: Invalid IF command nested into another IF command on the same table row: IF b]`;
@@ -57118,7 +58088,360 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "686B7280",
+ "w14:paraId": "686B7280",
+ "w14:textId": "77777777",
+ "w:rsidP": "005B2341",
+ "w:rsidR": "005B2341",
+ "w:rsidRDefault": "005B2341",
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:p",
+ },
+ {
+ "_attrs": {
+ "w14:paraId": "576C70BA",
+ "w14:textId": "651026D3",
+ "w:rsidP": "007856C0",
+ "w:rsidR": "005B2341",
+ "w:rsidRDefault": "005B2341",
+ },
+ "_children": [
+ {
+ "_attrs": {
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "junyao",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:r",
+ },
+ {
+ "_attrs": {},
+ "_children": [
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:r",
+ },
+ {
+ "_attrs": {
+ "w:type": "spellStart",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:proofErr",
+ },
+ {
+ "_attrs": {
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [
+ {
+ "_attrs": {},
+ "_children": [
+ {
+ "_attrs": {
+ "w:ascii": "Microsoft JhengHei",
+ "w:cs": "Microsoft JhengHei",
+ "w:eastAsia": "Microsoft JhengHei",
+ "w:hAnsi": "Microsoft JhengHei",
+ "w:hint": "eastAsia",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:rFonts",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:rPr",
+ },
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:r",
+ },
+ {
+ "_attrs": {
+ "w:type": "spellEnd",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:proofErr",
+ },
+ {
+ "_attrs": {
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:r",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:p",
+ },
+ {
+ "_attrs": {
+ "w14:paraId": "64757D95",
+ "w14:textId": "77777777",
+ "w:rsidP": "005B2341",
+ "w:rsidR": "005B2341",
+ "w:rsidRDefault": "005B2341",
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:p",
+ },
+ {
+ "_attrs": {
+ "w14:paraId": "0A5FB851",
+ "w14:textId": "77777777",
+ "w:rsidP": "005B2341",
+ "w:rsidR": "005B2341",
+ "w:rsidRDefault": "005B2341",
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:p",
+ },
+ {
+ "_attrs": {
+ "w14:paraId": "152EA038",
+ "w14:textId": "264863A8",
+ "w:rsidP": "005B2341",
+ "w:rsidR": "005B2341",
+ "w:rsidRDefault": "005B2341",
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [
+ {
+ "_attrs": {
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "hong",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:r",
+ },
+ {
+ "_attrs": {},
+ "_children": [
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:r",
+ },
+ {
+ "_attrs": {
+ "w:type": "spellStart",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:proofErr",
+ },
+ {
+ "_attrs": {
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [
+ {
+ "_attrs": {},
+ "_children": [
+ {
+ "_attrs": {
+ "w:ascii": "MS Gothic",
+ "w:cs": "MS Gothic",
+ "w:eastAsia": "MS Gothic",
+ "w:hAnsi": "MS Gothic",
+ "w:hint": "eastAsia",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:rFonts",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:rPr",
+ },
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:r",
+ },
+ {
+ "_attrs": {
+ "w:type": "spellEnd",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:proofErr",
+ },
+ {
+ "_attrs": {
+ "w:rsidRPr": "007856C0",
+ },
+ "_children": [
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:r",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:p",
+ },
+ {
+ "_attrs": {
+ "w14:paraId": "38C53EF0",
"w14:textId": "77777777",
"w:rsidP": "005B2341",
"w:rsidR": "005B2341",
@@ -57132,11 +58455,12 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "576C70BA",
- "w14:textId": "651026D3",
- "w:rsidP": "007856C0",
+ "w14:paraId": "020C58AE",
+ "w14:textId": "4A70A699",
+ "w:rsidP": "005B2341",
"w:rsidR": "005B2341",
"w:rsidRDefault": "005B2341",
+ "w:rsidRPr": "007856C0",
},
"_children": [
{
@@ -57287,7 +58611,7 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "64757D95",
+ "w14:paraId": "2EB2B65F",
"w14:textId": "77777777",
"w:rsidP": "005B2341",
"w:rsidR": "005B2341",
@@ -57301,9 +58625,9 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "0A5FB851",
+ "w14:paraId": "33412000",
"w14:textId": "77777777",
- "w:rsidP": "005B2341",
+ "w:rsidP": "007856C0",
"w:rsidR": "005B2341",
"w:rsidRDefault": "005B2341",
"w:rsidRPr": "007856C0",
@@ -57315,42 +58639,141 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "152EA038",
- "w14:textId": "264863A8",
- "w:rsidP": "005B2341",
"w:rsidR": "005B2341",
- "w:rsidRDefault": "005B2341",
"w:rsidRPr": "007856C0",
+ "w:rsidSect": "0019199C",
},
"_children": [
{
"_attrs": {
- "w:rsidRPr": "007856C0",
+ "w:h": "16840",
+ "w:w": "11900",
},
- "_children": [
- {
- "_attrs": {
- "xml:space": "preserve",
- },
- "_children": [
- {
- "_children": [],
- "_fTextNode": true,
- "_parent": [Circular],
- "_text": "hong",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:t",
- },
- ],
+ "_children": [],
"_fTextNode": false,
"_parent": [Circular],
- "_tag": "w:r",
+ "_tag": "w:pgSz",
},
{
- "_attrs": {},
+ "_attrs": {
+ "w:bottom": "1440",
+ "w:footer": "708",
+ "w:gutter": "0",
+ "w:header": "708",
+ "w:left": "1440",
+ "w:right": "1440",
+ "w:top": "1440",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:pgMar",
+ },
+ {
+ "_attrs": {
+ "w:space": "708",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:cols",
+ },
+ {
+ "_attrs": {
+ "w:linePitch": "360",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:docGrid",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:sectPr",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:body",
+ },
+ ],
+ "_fTextNode": false,
+ "_tag": "w:document",
+}
+`;
+
+exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Chinese) with custom delimiter 1`] = `
+{
+ "_attrs": {
+ "mc:Ignorable": "w14 w15 w16se w16cid wp14",
+ "xmlns:aink": "http://schemas.microsoft.com/office/drawing/2016/ink",
+ "xmlns:am3d": "http://schemas.microsoft.com/office/drawing/2017/model3d",
+ "xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
+ "xmlns:cx1": "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",
+ "xmlns:cx2": "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",
+ "xmlns:cx3": "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",
+ "xmlns:cx4": "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",
+ "xmlns:cx5": "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",
+ "xmlns:cx6": "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",
+ "xmlns:cx7": "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",
+ "xmlns:cx8": "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",
+ "xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math",
+ "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
+ "xmlns:o": "urn:schemas-microsoft-com:office:office",
+ "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
+ "xmlns:v": "urn:schemas-microsoft-com:vml",
+ "xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ "xmlns:w10": "urn:schemas-microsoft-com:office:word",
+ "xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml",
+ "xmlns:w15": "http://schemas.microsoft.com/office/word/2012/wordml",
+ "xmlns:w16cid": "http://schemas.microsoft.com/office/word/2016/wordml/cid",
+ "xmlns:w16se": "http://schemas.microsoft.com/office/word/2015/wordml/symex",
+ "xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml",
+ "xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
+ "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
+ "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
+ "xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
+ "xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
+ "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
+ },
+ "_children": [
+ {
+ "_attrs": {},
+ "_children": [
+ {
+ "_attrs": {
+ "w14:paraId": "6BF6C63C",
+ "w14:textId": "03D60101",
+ "w:rsidP": "00F95E1F",
+ "w:rsidR": "00F35C33",
+ "w:rsidRDefault": "00D85011",
+ "w:rsidRPr": "00F95E1F",
+ },
+ "_children": [
+ {
+ "_attrs": {
+ "w:id": "0",
+ "w:name": "_GoBack",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:bookmarkStart",
+ },
+ {
+ "_attrs": {
+ "w:id": "0",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:bookmarkEnd",
+ },
+ {
+ "_attrs": {
+ "w:rsidRPr": "00F95E1F",
+ },
"_children": [
{
"_attrs": {
@@ -57361,7 +58784,7 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
"_children": [],
"_fTextNode": true,
"_parent": [Circular],
- "_text": "",
+ "_text": "hong",
},
],
"_fTextNode": false,
@@ -57384,7 +58807,7 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:rsidRPr": "007856C0",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [
{
@@ -57440,7 +58863,7 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:rsidRPr": "007856C0",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [
{
@@ -57471,12 +58894,12 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "38C53EF0",
- "w14:textId": "77777777",
- "w:rsidP": "005B2341",
- "w:rsidR": "005B2341",
- "w:rsidRDefault": "005B2341",
- "w:rsidRPr": "007856C0",
+ "w14:paraId": "60A37F38",
+ "w14:textId": "4190B879",
+ "w:rsidP": "00F95E1F",
+ "w:rsidR": "00D85011",
+ "w:rsidRDefault": "00D85011",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [],
"_fTextNode": false,
@@ -57485,17 +58908,17 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "020C58AE",
- "w14:textId": "4A70A699",
- "w:rsidP": "005B2341",
- "w:rsidR": "005B2341",
- "w:rsidRDefault": "005B2341",
- "w:rsidRPr": "007856C0",
+ "w14:paraId": "297A6708",
+ "w14:textId": "0C0851F2",
+ "w:rsidP": "00F95E1F",
+ "w:rsidR": "00D85011",
+ "w:rsidRDefault": "00D85011",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [
{
"_attrs": {
- "w:rsidRPr": "007856C0",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [
{
@@ -57519,30 +58942,6 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
"_parent": [Circular],
"_tag": "w:r",
},
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {
- "xml:space": "preserve",
- },
- "_children": [
- {
- "_children": [],
- "_fTextNode": true,
- "_parent": [Circular],
- "_text": "",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:t",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:r",
- },
{
"_attrs": {
"w:type": "spellStart",
@@ -57554,7 +58953,7 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:rsidRPr": "007856C0",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [
{
@@ -57610,7 +59009,7 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:rsidRPr": "007856C0",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [
{
@@ -57641,26 +59040,12 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "2EB2B65F",
- "w14:textId": "77777777",
- "w:rsidP": "005B2341",
- "w:rsidR": "005B2341",
- "w:rsidRDefault": "005B2341",
- "w:rsidRPr": "007856C0",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:p",
- },
- {
- "_attrs": {
- "w14:paraId": "33412000",
- "w14:textId": "77777777",
- "w:rsidP": "007856C0",
- "w:rsidR": "005B2341",
- "w:rsidRDefault": "005B2341",
- "w:rsidRPr": "007856C0",
+ "w14:paraId": "6FE1B114",
+ "w14:textId": "315C8C84",
+ "w:rsidP": "00F95E1F",
+ "w:rsidR": "00D85011",
+ "w:rsidRDefault": "00D85011",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [],
"_fTextNode": false,
@@ -57669,141 +59054,42 @@ exports[`sandbox Template processing 107a non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:rsidR": "005B2341",
- "w:rsidRPr": "007856C0",
- "w:rsidSect": "0019199C",
- },
- "_children": [
- {
- "_attrs": {
- "w:h": "16840",
- "w:w": "11900",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pgSz",
- },
- {
- "_attrs": {
- "w:bottom": "1440",
- "w:footer": "708",
- "w:gutter": "0",
- "w:header": "708",
- "w:left": "1440",
- "w:right": "1440",
- "w:top": "1440",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pgMar",
- },
- {
- "_attrs": {
- "w:space": "708",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:cols",
- },
- {
- "_attrs": {
- "w:linePitch": "360",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:docGrid",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:sectPr",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:body",
- },
- ],
- "_fTextNode": false,
- "_tag": "w:document",
-}
-`;
-
-exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Chinese) with custom delimiter 1`] = `
-{
- "_attrs": {
- "mc:Ignorable": "w14 w15 w16se w16cid wp14",
- "xmlns:aink": "http://schemas.microsoft.com/office/drawing/2016/ink",
- "xmlns:am3d": "http://schemas.microsoft.com/office/drawing/2017/model3d",
- "xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
- "xmlns:cx1": "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",
- "xmlns:cx2": "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",
- "xmlns:cx3": "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",
- "xmlns:cx4": "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",
- "xmlns:cx5": "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",
- "xmlns:cx6": "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",
- "xmlns:cx7": "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",
- "xmlns:cx8": "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",
- "xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math",
- "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
- "xmlns:o": "urn:schemas-microsoft-com:office:office",
- "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
- "xmlns:v": "urn:schemas-microsoft-com:vml",
- "xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
- "xmlns:w10": "urn:schemas-microsoft-com:office:word",
- "xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml",
- "xmlns:w15": "http://schemas.microsoft.com/office/word/2012/wordml",
- "xmlns:w16cid": "http://schemas.microsoft.com/office/word/2016/wordml/cid",
- "xmlns:w16se": "http://schemas.microsoft.com/office/word/2015/wordml/symex",
- "xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml",
- "xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
- "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
- "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
- "xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
- "xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
- "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {
- "w14:paraId": "6BF6C63C",
- "w14:textId": "03D60101",
+ "w14:paraId": "6742E140",
+ "w14:textId": "43F12D8C",
"w:rsidP": "00F95E1F",
- "w:rsidR": "00F35C33",
- "w:rsidRDefault": "00D85011",
+ "w:rsidR": "00F95E1F",
+ "w:rsidRDefault": "00F95E1F",
"w:rsidRPr": "00F95E1F",
},
"_children": [
{
"_attrs": {
- "w:id": "0",
- "w:name": "_GoBack",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:bookmarkStart",
- },
- {
- "_attrs": {
- "w:id": "0",
+ "w:rsidRPr": "00F95E1F",
},
- "_children": [],
+ "_children": [
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "hong",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
"_fTextNode": false,
"_parent": [Circular],
- "_tag": "w:bookmarkEnd",
+ "_tag": "w:r",
},
{
- "_attrs": {
- "w:rsidRPr": "00F95E1F",
- },
+ "_attrs": {},
"_children": [
{
"_attrs": {
@@ -57814,7 +59100,7 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
"_children": [],
"_fTextNode": true,
"_parent": [Circular],
- "_text": "hong",
+ "_text": "",
},
],
"_fTextNode": false,
@@ -57924,11 +59210,11 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "60A37F38",
- "w14:textId": "4190B879",
+ "w14:paraId": "0BC84266",
+ "w14:textId": "77777777",
"w:rsidP": "00F95E1F",
- "w:rsidR": "00D85011",
- "w:rsidRDefault": "00D85011",
+ "w:rsidR": "00F95E1F",
+ "w:rsidRDefault": "00F95E1F",
"w:rsidRPr": "00F95E1F",
},
"_children": [],
@@ -57938,12 +59224,11 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "297A6708",
- "w14:textId": "0C0851F2",
+ "w14:paraId": "46877074",
+ "w14:textId": "338B35A6",
"w:rsidP": "00F95E1F",
- "w:rsidR": "00D85011",
- "w:rsidRDefault": "00D85011",
- "w:rsidRPr": "00F95E1F",
+ "w:rsidR": "00F95E1F",
+ "w:rsidRDefault": "00F95E1F",
},
"_children": [
{
@@ -57972,6 +59257,30 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
"_parent": [Circular],
"_tag": "w:r",
},
+ {
+ "_attrs": {},
+ "_children": [
+ {
+ "_attrs": {
+ "xml:space": "preserve",
+ },
+ "_children": [
+ {
+ "_children": [],
+ "_fTextNode": true,
+ "_parent": [Circular],
+ "_text": "",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:t",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:r",
+ },
{
"_attrs": {
"w:type": "spellStart",
@@ -58070,12 +59379,11 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "6FE1B114",
- "w14:textId": "315C8C84",
+ "w14:paraId": "7E960016",
+ "w14:textId": "5B8E4394",
"w:rsidP": "00F95E1F",
- "w:rsidR": "00D85011",
- "w:rsidRDefault": "00D85011",
- "w:rsidRPr": "00F95E1F",
+ "w:rsidR": "00F95E1F",
+ "w:rsidRDefault": "00F95E1F",
},
"_children": [],
"_fTextNode": false,
@@ -58084,8 +59392,8 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "6742E140",
- "w14:textId": "43F12D8C",
+ "w14:paraId": "107BB8B5",
+ "w14:textId": "46BE478F",
"w:rsidP": "00F95E1F",
"w:rsidR": "00F95E1F",
"w:rsidRDefault": "00F95E1F",
@@ -58240,7 +59548,7 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "0BC84266",
+ "w14:paraId": "7569C168",
"w14:textId": "77777777",
"w:rsidP": "00F95E1F",
"w:rsidR": "00F95E1F",
@@ -58254,11 +59562,12 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "46877074",
- "w14:textId": "338B35A6",
+ "w14:paraId": "752DA1D2",
+ "w14:textId": "511C7589",
"w:rsidP": "00F95E1F",
"w:rsidR": "00F95E1F",
"w:rsidRDefault": "00F95E1F",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [
{
@@ -58409,11 +59718,12 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "7E960016",
- "w14:textId": "5B8E4394",
+ "w14:paraId": "7BC35AB4",
+ "w14:textId": "77777777",
"w:rsidP": "00F95E1F",
"w:rsidR": "00F95E1F",
"w:rsidRDefault": "00F95E1F",
+ "w:rsidRPr": "00F95E1F",
},
"_children": [],
"_fTextNode": false,
@@ -58422,19 +59732,145 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "107BB8B5",
- "w14:textId": "46BE478F",
- "w:rsidP": "00F95E1F",
"w:rsidR": "00F95E1F",
- "w:rsidRDefault": "00F95E1F",
"w:rsidRPr": "00F95E1F",
+ "w:rsidSect": "0019199C",
},
"_children": [
{
"_attrs": {
- "w:rsidRPr": "00F95E1F",
+ "w:h": "16840",
+ "w:w": "11900",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:pgSz",
+ },
+ {
+ "_attrs": {
+ "w:bottom": "1440",
+ "w:footer": "708",
+ "w:gutter": "0",
+ "w:header": "708",
+ "w:left": "1440",
+ "w:right": "1440",
+ "w:top": "1440",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:pgMar",
+ },
+ {
+ "_attrs": {
+ "w:space": "708",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:cols",
+ },
+ {
+ "_attrs": {
+ "w:linePitch": "360",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:docGrid",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:sectPr",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:body",
+ },
+ ],
+ "_fTextNode": false,
+ "_tag": "w:document",
+}
+`;
+
+exports[`sandbox Template processing 112a failFast: false lists all errors in the document before failing. 1`] = `
+[
+ [Error: Error executing command 'notavailable': ReferenceError: notavailable is not defined],
+ [Error: Error executing command 'something': ReferenceError: something is not defined],
+ [Error: Invalid command: END-FOR company],
+ [Error: Unterminated FOR-loop ('FOR company'). Make sure each FOR loop has a corresponding END-FOR command.],
+]
+`;
+
+exports[`sandbox Template processing 112b failFast: true has the same behaviour as when failFast is undefined 1`] = `[Error: Error executing command 'notavailable': ReferenceError: notavailable is not defined]`;
+
+exports[`sandbox Template processing 131 correctly handles Office 365 .docx files 1`] = `
+{
+ "_attrs": {
+ "mc:Ignorable": "w14 w15 wp14",
+ "xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math",
+ "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
+ "xmlns:o": "urn:schemas-microsoft-com:office:office",
+ "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
+ "xmlns:v": "urn:schemas-microsoft-com:vml",
+ "xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
+ "xmlns:w10": "urn:schemas-microsoft-com:office:word",
+ "xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml",
+ "xmlns:w15": "http://schemas.microsoft.com/office/word/2012/wordml",
+ "xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml",
+ "xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
+ "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
+ "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
+ "xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
+ "xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
+ "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
+ },
+ "_children": [
+ {
+ "_attrs": {},
+ "_children": [
+ {
+ "_attrs": {
+ "w14:paraId": "3BFEFB25",
+ "wp14:noSpellErr": "1",
+ "wp14:textId": "2AD722EA",
+ "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordml",
+ },
+ "_children": [
+ {
+ "_attrs": {
+ "w:id": "0",
+ "w:name": "_GoBack",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:bookmarkStart",
+ },
+ {
+ "_attrs": {
+ "w:id": "0",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:bookmarkEnd",
+ },
+ {
+ "_attrs": {
+ "w:rsidR": "4C197E99",
},
"_children": [
+ {
+ "_attrs": {},
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:rPr",
+ },
{
"_attrs": {
"xml:space": "preserve",
@@ -58444,21 +59880,13 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
"_children": [],
"_fTextNode": true,
"_parent": [Circular],
- "_text": "hong",
+ "_text": "first value!",
},
],
"_fTextNode": false,
"_parent": [Circular],
"_tag": "w:t",
},
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:r",
- },
- {
- "_attrs": {},
- "_children": [
{
"_attrs": {
"xml:space": "preserve",
@@ -58482,7 +59910,7 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:type": "spellStart",
+ "w:type": "gramStart",
},
"_children": [],
"_fTextNode": false,
@@ -58491,26 +59919,12 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:rsidRPr": "00F95E1F",
+ "w:rsidR": "4C197E99",
},
"_children": [
{
"_attrs": {},
- "_children": [
- {
- "_attrs": {
- "w:ascii": "MS Gothic",
- "w:cs": "MS Gothic",
- "w:eastAsia": "MS Gothic",
- "w:hAnsi": "MS Gothic",
- "w:hint": "eastAsia",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:rFonts",
- },
- ],
+ "_children": [],
"_fTextNode": false,
"_parent": [Circular],
"_tag": "w:rPr",
@@ -58538,7 +59952,7 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:type": "spellEnd",
+ "w:type": "gramEnd",
},
"_children": [],
"_fTextNode": false,
@@ -58547,9 +59961,16 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:rsidRPr": "00F95E1F",
+ "w:rsidR": "4C197E99",
},
"_children": [
+ {
+ "_attrs": {},
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:rPr",
+ },
{
"_attrs": {
"xml:space": "preserve",
@@ -58559,7 +59980,7 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
"_children": [],
"_fTextNode": true,
"_parent": [Circular],
- "_text": "",
+ "_text": " ",
},
],
"_fTextNode": false,
@@ -58578,57 +59999,105 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w14:paraId": "7569C168",
- "w14:textId": "77777777",
- "w:rsidP": "00F95E1F",
- "w:rsidR": "00F95E1F",
- "w:rsidRDefault": "00F95E1F",
- "w:rsidRPr": "00F95E1F",
+ "w14:paraId": "5DAB0FCA",
+ "w14:textId": "67F23F00",
+ "w:rsidP": "4C197E99",
+ "w:rsidR": "4C197E99",
+ "w:rsidRDefault": "4C197E99",
},
- "_children": [],
+ "_children": [
+ {
+ "_attrs": {},
+ "_children": [
+ {
+ "_attrs": {
+ "w:val": "Normal",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:pStyle",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:pPr",
+ },
+ ],
"_fTextNode": false,
"_parent": [Circular],
"_tag": "w:p",
},
{
"_attrs": {
- "w14:paraId": "752DA1D2",
- "w14:textId": "511C7589",
- "w:rsidP": "00F95E1F",
- "w:rsidR": "00F95E1F",
- "w:rsidRDefault": "00F95E1F",
- "w:rsidRPr": "00F95E1F",
+ "w14:paraId": "4DEFE58C",
+ "w14:textId": "03755723",
+ "w:rsidP": "4C197E99",
+ "w:rsidR": "4C197E99",
+ "w:rsidRDefault": "4C197E99",
},
"_children": [
{
- "_attrs": {
- "w:rsidRPr": "00F95E1F",
- },
+ "_attrs": {},
"_children": [
{
"_attrs": {
- "xml:space": "preserve",
+ "w:val": "Normal",
},
- "_children": [
- {
- "_children": [],
- "_fTextNode": true,
- "_parent": [Circular],
- "_text": "junyao",
- },
- ],
+ "_children": [],
"_fTextNode": false,
"_parent": [Circular],
- "_tag": "w:t",
+ "_tag": "w:pStyle",
},
],
"_fTextNode": false,
"_parent": [Circular],
- "_tag": "w:r",
+ "_tag": "w:pPr",
},
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:p",
+ },
+ {
+ "_attrs": {
+ "w14:noSpellErr": "1",
+ "w14:paraId": "664E8C7B",
+ "w14:textId": "388D7CD7",
+ "w:rsidP": "4C197E99",
+ "w:rsidR": "4C197E99",
+ "w:rsidRDefault": "4C197E99",
+ },
+ "_children": [
{
"_attrs": {},
"_children": [
+ {
+ "_attrs": {
+ "w:val": "Normal",
+ },
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:pStyle",
+ },
+ ],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:pPr",
+ },
+ {
+ "_attrs": {
+ "w:rsidR": "4C197E99",
+ },
+ "_children": [
+ {
+ "_attrs": {},
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:rPr",
+ },
{
"_attrs": {
"xml:space": "preserve",
@@ -58638,7 +60107,7 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
"_children": [],
"_fTextNode": true,
"_parent": [Circular],
- "_text": "",
+ "_text": "second value!",
},
],
"_fTextNode": false,
@@ -58652,7 +60121,7 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:type": "spellStart",
+ "w:type": "gramStart",
},
"_children": [],
"_fTextNode": false,
@@ -58661,26 +60130,12 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:rsidRPr": "00F95E1F",
+ "w:rsidR": "4C197E99",
},
"_children": [
{
"_attrs": {},
- "_children": [
- {
- "_attrs": {
- "w:ascii": "Microsoft JhengHei",
- "w:cs": "Microsoft JhengHei",
- "w:eastAsia": "Microsoft JhengHei",
- "w:hAnsi": "Microsoft JhengHei",
- "w:hint": "eastAsia",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:rFonts",
- },
- ],
+ "_children": [],
"_fTextNode": false,
"_parent": [Circular],
"_tag": "w:rPr",
@@ -58708,7 +60163,7 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:type": "spellEnd",
+ "w:type": "gramEnd",
},
"_children": [],
"_fTextNode": false,
@@ -58717,9 +60172,16 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:rsidRPr": "00F95E1F",
+ "w:rsidR": "4C197E99",
},
"_children": [
+ {
+ "_attrs": {},
+ "_children": [],
+ "_fTextNode": false,
+ "_parent": [Circular],
+ "_tag": "w:rPr",
+ },
{
"_attrs": {
"xml:space": "preserve",
@@ -58747,30 +60209,13 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
"_tag": "w:p",
},
{
- "_attrs": {
- "w14:paraId": "7BC35AB4",
- "w14:textId": "77777777",
- "w:rsidP": "00F95E1F",
- "w:rsidR": "00F95E1F",
- "w:rsidRDefault": "00F95E1F",
- "w:rsidRPr": "00F95E1F",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:p",
- },
- {
- "_attrs": {
- "w:rsidR": "00F95E1F",
- "w:rsidRPr": "00F95E1F",
- "w:rsidSect": "0019199C",
- },
+ "_attrs": {},
"_children": [
{
"_attrs": {
- "w:h": "16840",
- "w:w": "11900",
+ "w:h": "16838",
+ "w:orient": "portrait",
+ "w:w": "11906",
},
"_children": [],
"_fTextNode": false,
@@ -58780,9 +60225,9 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
{
"_attrs": {
"w:bottom": "1440",
- "w:footer": "708",
+ "w:footer": "720",
"w:gutter": "0",
- "w:header": "708",
+ "w:header": "720",
"w:left": "1440",
"w:right": "1440",
"w:top": "1440",
@@ -58794,7 +60239,7 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
},
{
"_attrs": {
- "w:space": "708",
+ "w:space": "720",
},
"_children": [],
"_fTextNode": false,
@@ -58826,21 +60271,1008 @@ exports[`sandbox Template processing 107b non-alphanumeric INS commands (e.g. Ch
}
`;
-exports[`sandbox Template processing 112a failFast: false lists all errors in the document before failing. 1`] = `
-[
- [Error: Error executing command 'notavailable': ReferenceError: notavailable is not defined],
- [Error: Error executing command 'something': ReferenceError: something is not defined],
- [Error: Invalid command: END-FOR company],
- [Error: Unterminated FOR-loop ('FOR company'). Make sure each FOR loop has a corresponding END-FOR command.],
-]
+exports[`sandbox Template processing Access current element index from FOR loop 1`] = `
+"
+
+
+
+
+
+
+
+
+ Company
+
+
+
+
+
+
+ (
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+
+
+
+
+
+
+ :
+
+
+ MEGACORP
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Executives:
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ Excellent CEO
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+ Someone
+
+
+
+
+
+
+
+
+
+ Company
+
+
+
+
+
+
+ (
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+
+
+
+
+
+
+ :
+
+
+ SUPERCORP
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Executives:
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ John Smith
+
+
+
+
+
+
+
+
+
+ Company
+
+
+
+
+
+
+ (
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+
+
+
+
+
+
+ :
+
+
+ ULTRACORP
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Executives:
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+ Who else
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+ Can't be me
+
+
+
+
+
+
+
+
+
+
+
+"
+`;
+
+exports[`sandbox Template processing Dynamic table columns 1`] = `
+"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"
+`;
+
+exports[`sandbox Template processing Dynamic table columns with dynamic rows 1`] = `
+"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Row 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Row 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Row 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Row 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Row 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Row 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Row 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Row 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Row 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+ Column 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"
+`;
+
+exports[`sandbox Template processing HTML in table (see PR #233) 1`] = `
+"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ First Name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Last Name
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Smith
+
+
+
+
+
+
+
+
+
+
+
+
+
+"
`;
-exports[`sandbox Template processing 112b failFast: true has the same behaviour as when failFast is undefined 1`] = `[Error: Error executing command 'notavailable': ReferenceError: notavailable is not defined]`;
-
-exports[`sandbox Template processing 131 correctly handles Office 365 .docx files 1`] = `
+exports[`sandbox Template processing INS command is an array (see issue #214) 1`] = `
{
"_attrs": {
- "mc:Ignorable": "w14 w15 wp14",
+ "mc:Ignorable": "w14 w15 w16se w16cid w16 w16cex wp14",
+ "xmlns:aink": "http://schemas.microsoft.com/office/drawing/2016/ink",
+ "xmlns:am3d": "http://schemas.microsoft.com/office/drawing/2017/model3d",
+ "xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
+ "xmlns:cx1": "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",
+ "xmlns:cx2": "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",
+ "xmlns:cx3": "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",
+ "xmlns:cx4": "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",
+ "xmlns:cx5": "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",
+ "xmlns:cx6": "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",
+ "xmlns:cx7": "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",
+ "xmlns:cx8": "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",
"xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math",
"xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
"xmlns:o": "urn:schemas-microsoft-com:office:office",
@@ -58850,155 +61282,74 @@ exports[`sandbox Template processing 131 correctly handles Office 365 .docx file
"xmlns:w10": "urn:schemas-microsoft-com:office:word",
"xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml",
"xmlns:w15": "http://schemas.microsoft.com/office/word/2012/wordml",
+ "xmlns:w16": "http://schemas.microsoft.com/office/word/2018/wordml",
+ "xmlns:w16cex": "http://schemas.microsoft.com/office/word/2018/wordml/cex",
+ "xmlns:w16cid": "http://schemas.microsoft.com/office/word/2016/wordml/cid",
+ "xmlns:w16se": "http://schemas.microsoft.com/office/word/2015/wordml/symex",
"xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml",
"xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
"xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
"xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
"xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
"xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
- "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {
- "w14:paraId": "3BFEFB25",
- "wp14:noSpellErr": "1",
- "wp14:textId": "2AD722EA",
- "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordml",
- },
- "_children": [
- {
- "_attrs": {
- "w:id": "0",
- "w:name": "_GoBack",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:bookmarkStart",
- },
- {
- "_attrs": {
- "w:id": "0",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:bookmarkEnd",
- },
+ "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
+ },
+ "_children": [
+ {
+ "_attrs": {},
+ "_children": [
+ {
+ "_attrs": {
+ "w14:paraId": "3A705D94",
+ "w14:textId": "044CEA80",
+ "w:rsidP": "00C863B5",
+ "w:rsidR": "00C863B5",
+ "w:rsidRDefault": "00C863B5",
+ },
+ "_children": [
{
- "_attrs": {
- "w:rsidR": "4C197E99",
- },
+ "_attrs": {},
"_children": [
{
"_attrs": {},
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:rPr",
- },
- {
- "_attrs": {
- "xml:space": "preserve",
- },
- "_children": [
- {
- "_children": [],
- "_fTextNode": true,
- "_parent": [Circular],
- "_text": "first value!",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:t",
- },
- {
- "_attrs": {
- "xml:space": "preserve",
- },
"_children": [
{
+ "_attrs": {
+ "w:val": "es-ES",
+ },
"_children": [],
- "_fTextNode": true,
+ "_fTextNode": false,
"_parent": [Circular],
- "_text": "",
+ "_tag": "w:lang",
},
],
"_fTextNode": false,
"_parent": [Circular],
- "_tag": "w:t",
+ "_tag": "w:rPr",
},
],
"_fTextNode": false,
"_parent": [Circular],
- "_tag": "w:r",
- },
- {
- "_attrs": {
- "w:type": "gramStart",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:proofErr",
+ "_tag": "w:pPr",
},
{
- "_attrs": {
- "w:rsidR": "4C197E99",
- },
+ "_attrs": {},
"_children": [
{
"_attrs": {},
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:rPr",
- },
- {
- "_attrs": {
- "xml:space": "preserve",
- },
"_children": [
{
+ "_attrs": {
+ "w:val": "es-ES",
+ },
"_children": [],
- "_fTextNode": true,
+ "_fTextNode": false,
"_parent": [Circular],
- "_text": "",
+ "_tag": "w:lang",
},
],
"_fTextNode": false,
"_parent": [Circular],
- "_tag": "w:t",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:r",
- },
- {
- "_attrs": {
- "w:type": "gramEnd",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:proofErr",
- },
- {
- "_attrs": {
- "w:rsidR": "4C197E99",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
"_tag": "w:rPr",
},
{
@@ -59010,7 +61361,7 @@ exports[`sandbox Template processing 131 correctly handles Office 365 .docx file
"_children": [],
"_fTextNode": true,
"_parent": [Circular],
- "_text": " ",
+ "_text": "a,b,c",
},
],
"_fTextNode": false,
@@ -59029,189 +61380,17 @@ exports[`sandbox Template processing 131 correctly handles Office 365 .docx file
},
{
"_attrs": {
- "w14:paraId": "5DAB0FCA",
- "w14:textId": "67F23F00",
- "w:rsidP": "4C197E99",
- "w:rsidR": "4C197E99",
- "w:rsidRDefault": "4C197E99",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {
- "w:val": "Normal",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pStyle",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pPr",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:p",
- },
- {
- "_attrs": {
- "w14:paraId": "4DEFE58C",
- "w14:textId": "03755723",
- "w:rsidP": "4C197E99",
- "w:rsidR": "4C197E99",
- "w:rsidRDefault": "4C197E99",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {
- "w:val": "Normal",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pStyle",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pPr",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:p",
- },
- {
- "_attrs": {
- "w14:noSpellErr": "1",
- "w14:paraId": "664E8C7B",
- "w14:textId": "388D7CD7",
- "w:rsidP": "4C197E99",
- "w:rsidR": "4C197E99",
- "w:rsidRDefault": "4C197E99",
+ "w14:paraId": "743B5CEB",
+ "w14:textId": "6C1E73F1",
+ "w:rsidP": "00C863B5",
+ "w:rsidR": "00D310BE",
+ "w:rsidRDefault": "00FE460C",
+ "w:rsidRPr": "00C863B5",
},
"_children": [
{
"_attrs": {},
"_children": [
- {
- "_attrs": {
- "w:val": "Normal",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pStyle",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pPr",
- },
- {
- "_attrs": {
- "w:rsidR": "4C197E99",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:rPr",
- },
- {
- "_attrs": {
- "xml:space": "preserve",
- },
- "_children": [
- {
- "_children": [],
- "_fTextNode": true,
- "_parent": [Circular],
- "_text": "second value!",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:t",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:r",
- },
- {
- "_attrs": {
- "w:type": "gramStart",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:proofErr",
- },
- {
- "_attrs": {
- "w:rsidR": "4C197E99",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:rPr",
- },
- {
- "_attrs": {
- "xml:space": "preserve",
- },
- "_children": [
- {
- "_children": [],
- "_fTextNode": true,
- "_parent": [Circular],
- "_text": "",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:t",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:r",
- },
- {
- "_attrs": {
- "w:type": "gramEnd",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:proofErr",
- },
- {
- "_attrs": {
- "w:rsidR": "4C197E99",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:rPr",
- },
{
"_attrs": {
"xml:space": "preserve",
@@ -59221,7 +61400,7 @@ exports[`sandbox Template processing 131 correctly handles Office 365 .docx file
"_children": [],
"_fTextNode": true,
"_parent": [Circular],
- "_text": "",
+ "_text": "1,2,3",
},
],
"_fTextNode": false,
@@ -59239,13 +61418,15 @@ exports[`sandbox Template processing 131 correctly handles Office 365 .docx file
"_tag": "w:p",
},
{
- "_attrs": {},
+ "_attrs": {
+ "w:rsidR": "00D310BE",
+ "w:rsidRPr": "00C863B5",
+ },
"_children": [
{
"_attrs": {
- "w:h": "16838",
- "w:orient": "portrait",
- "w:w": "11906",
+ "w:h": "15840",
+ "w:w": "12240",
},
"_children": [],
"_fTextNode": false,
@@ -59254,13 +61435,13 @@ exports[`sandbox Template processing 131 correctly handles Office 365 .docx file
},
{
"_attrs": {
- "w:bottom": "1440",
- "w:footer": "720",
+ "w:bottom": "1417",
+ "w:footer": "708",
"w:gutter": "0",
- "w:header": "720",
- "w:left": "1440",
- "w:right": "1440",
- "w:top": "1440",
+ "w:header": "708",
+ "w:left": "1701",
+ "w:right": "1701",
+ "w:top": "1417",
},
"_children": [],
"_fTextNode": false,
@@ -59269,7 +61450,7 @@ exports[`sandbox Template processing 131 correctly handles Office 365 .docx file
},
{
"_attrs": {
- "w:space": "720",
+ "w:space": "708",
},
"_children": [],
"_fTextNode": false,
@@ -59301,1246 +61482,1007 @@ exports[`sandbox Template processing 131 correctly handles Office 365 .docx file
}
`;
-exports[`sandbox Template processing Access current element index from FOR loop 1`] = `
+exports[`sandbox Template processing INS in header and footer 1`] = `
"
-
+
-
-
+
+
+
+
+ this goes into the body
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"
+`;
+
+exports[`sandbox Template processing Nested IF statements on same line 1`] = `[Error: Invalid IF command nested into another IF command on the same line: IF b]`;
+
+exports[`sandbox Template processing Nested IF statements on same line with allowNestedIf: true 1`] = `
+"
+
+
+
+
+
+
+
+
+
+
+
+
+ This line should be displayed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
-
-
+
- Company
+ text
-
+
-
-
+
+
+ should be visible
+
+
+
+
+
+ ,
+
+
+
+
+
- (
- 0
-
-
+
-
-
+
-
-
+
-
-
+
- )
+
-
+
+
-
-
+
- :
+
-
- MEGACORP
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This should also be visible in the same line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
-
+
+
+
-
-
+
- Executives:
+
+
+
+
+
+
+
+
+
+
+
+
+ This line should be displayed
+
+
+
+
+
+ in a loop
-
+
-
-
-
-
-
+
+
+
- 0
-
+
+
+
+ This line should be displayed
-
-
+
+
+
+ in a loop
-
+
+
+
+
+
+
+
-
+
+
+
+ This line should be displayed
-
- Excellent CEO
+
+
+
+
+ in a loop
-
+
-
-
-
-
-
+
+
+
- 1
-
+
+
+
+ This line should be displayed
-
-
+
+
+
+ in a loop
-
+
+
+
+
+
+
+
-
+
+
+
+ This line should be displayed
-
- Someone
+
+
+
+
+ in a loop
-
-
-
+
+
-
-
+
- Company
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
+
- (
- 1
-
-
+
+
-
-
+
+
-
-
+
-
-
+
- )
+
-
+
-
-
+
- :
+
-
- SUPERCORP
+
+
+
+
+
+
-
+
+
+
+
+
-
+
+
+
+
+
-
-
-
+
+
-
-
+
-
-
+
+
+
+
-
-
+
- Executives:
+
-
-
-
-
-
-
-
-
-
- 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
- John Smith
+
+
+
+
+
+
-
-
-
-
+
+
-
-
+
- Company
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- (
- 2
-
+
-
-
+
-
+
-
-
+
- )
+
-
+
+
-
-
+
- :
+
-
- ULTRACORP
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
+
-
-
+
+
+
-
-
+
- Executives:
+
-
-
-
-
-
-
-
-
-
+
- 0
+
+
+
+
+
+
-
-
-
- Who else
-
-
-
-
-
-
-
-
-
-
-
- 1
+
+
+
-
+
-
+
+
+
+ This
-
+
-
+
+
+
+ line should be displayed in a loop
-
- Can't be me
+
+
+
+
+ in same line,
-
-
-
-
-
-
-
-
-
-
-"
-`;
-
-exports[`sandbox Template processing Dynamic table columns 1`] = `
-"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Column 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Column 2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Column 3
-
-
-
-
-
-
-
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-"
-`;
-
-exports[`sandbox Template processing Dynamic table columns with dynamic rows 1`] = `
-"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Row 1
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Column 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Row 1
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Column 2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Row 1
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Column 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Row 2
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Column 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Row 2
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Column 2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Row 2
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Column 3
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Row 3
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Column 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Row 3
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Column 2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Row 3
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
- Column 3
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+
+ line should be displayed in a loop
+
+
+
+
+
+ in same line,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-"
-`;
-
-exports[`sandbox Template processing HTML in table (see PR #233) 1`] = `
-"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- First Name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Last Name
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Smith
-
-
-
-
-
-
-
-
-
-
-
-
-
-"
-`;
-
-exports[`sandbox Template processing INS command is an array (see issue #214) 1`] = `
-{
- "_attrs": {
- "mc:Ignorable": "w14 w15 w16se w16cid w16 w16cex wp14",
- "xmlns:aink": "http://schemas.microsoft.com/office/drawing/2016/ink",
- "xmlns:am3d": "http://schemas.microsoft.com/office/drawing/2017/model3d",
- "xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
- "xmlns:cx1": "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex",
- "xmlns:cx2": "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex",
- "xmlns:cx3": "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex",
- "xmlns:cx4": "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex",
- "xmlns:cx5": "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex",
- "xmlns:cx6": "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",
- "xmlns:cx7": "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",
- "xmlns:cx8": "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",
- "xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math",
- "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
- "xmlns:o": "urn:schemas-microsoft-com:office:office",
- "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
- "xmlns:v": "urn:schemas-microsoft-com:vml",
- "xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
- "xmlns:w10": "urn:schemas-microsoft-com:office:word",
- "xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml",
- "xmlns:w15": "http://schemas.microsoft.com/office/word/2012/wordml",
- "xmlns:w16": "http://schemas.microsoft.com/office/word/2018/wordml",
- "xmlns:w16cex": "http://schemas.microsoft.com/office/word/2018/wordml/cex",
- "xmlns:w16cid": "http://schemas.microsoft.com/office/word/2016/wordml/cid",
- "xmlns:w16se": "http://schemas.microsoft.com/office/word/2015/wordml/symex",
- "xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml",
- "xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
- "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
- "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
- "xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
- "xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
- "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {
- "w14:paraId": "3A705D94",
- "w14:textId": "044CEA80",
- "w:rsidP": "00C863B5",
- "w:rsidR": "00C863B5",
- "w:rsidRDefault": "00C863B5",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {
- "w:val": "es-ES",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:lang",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:rPr",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pPr",
- },
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {
- "w:val": "es-ES",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:lang",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:rPr",
- },
- {
- "_attrs": {
- "xml:space": "preserve",
- },
- "_children": [
- {
- "_children": [],
- "_fTextNode": true,
- "_parent": [Circular],
- "_text": "a,b,c",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:t",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:r",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:p",
- },
- {
- "_attrs": {
- "w14:paraId": "743B5CEB",
- "w14:textId": "6C1E73F1",
- "w:rsidP": "00C863B5",
- "w:rsidR": "00D310BE",
- "w:rsidRDefault": "00FE460C",
- "w:rsidRPr": "00C863B5",
- },
- "_children": [
- {
- "_attrs": {},
- "_children": [
- {
- "_attrs": {
- "xml:space": "preserve",
- },
- "_children": [
- {
- "_children": [],
- "_fTextNode": true,
- "_parent": [Circular],
- "_text": "1,2,3",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:t",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:r",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:p",
- },
- {
- "_attrs": {
- "w:rsidR": "00D310BE",
- "w:rsidRPr": "00C863B5",
- },
- "_children": [
- {
- "_attrs": {
- "w:h": "15840",
- "w:w": "12240",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pgSz",
- },
- {
- "_attrs": {
- "w:bottom": "1417",
- "w:footer": "708",
- "w:gutter": "0",
- "w:header": "708",
- "w:left": "1701",
- "w:right": "1701",
- "w:top": "1417",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:pgMar",
- },
- {
- "_attrs": {
- "w:space": "708",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:cols",
- },
- {
- "_attrs": {
- "w:linePitch": "360",
- },
- "_children": [],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:docGrid",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:sectPr",
- },
- ],
- "_fTextNode": false,
- "_parent": [Circular],
- "_tag": "w:body",
- },
- ],
- "_fTextNode": false,
- "_tag": "w:document",
-}
-`;
-
-exports[`sandbox Template processing INS in header and footer 1`] = `
-"
-
-
-
-
-
+
+
+
- this goes into the body
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+
+ line should be displayed in a loop
+
+
+
+
+
+ in same line,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+
+ line should be displayed in a loop
+
+
+
+
+
+ in same line,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This
+
+
+
+
+
+
+ line should be displayed in a loop
+
+
+
+
+
+ in same line,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -60548,8 +62490,6 @@ exports[`sandbox Template processing INS in header and footer 1`] = `
"
`;
-exports[`sandbox Template processing Nested IF statements on same line 1`] = `[Error: Invalid IF command nested into another IF command on the same line: IF b]`;
-
exports[`sandbox Template processing Nested IF statements on same row1 1`] = `[Error: Invalid IF command nested into another IF command on the same table row: IF b]`;
exports[`sandbox Template processing Nested IF statements on same row2 1`] = `[Error: Invalid IF command nested into another IF command on the same table row: IF b]`;
diff --git a/src/__tests__/fixtures/ifStatementsOnSameLineSkipValidation.docx b/src/__tests__/fixtures/ifStatementsOnSameLineSkipValidation.docx
new file mode 100644
index 0000000..11f1476
Binary files /dev/null and b/src/__tests__/fixtures/ifStatementsOnSameLineSkipValidation.docx differ
diff --git a/src/__tests__/templating.test.ts b/src/__tests__/templating.test.ts
index b656f6a..bf1c24b 100755
--- a/src/__tests__/templating.test.ts
+++ b/src/__tests__/templating.test.ts
@@ -1332,6 +1332,28 @@ Morbi dignissim consequat ex, non finibus est faucibus sodales. Integer sed just
return expect(result).rejects.toMatchSnapshot();
});
+ it('Nested IF statements on same line with allowNestedIf: true', async () => {
+ const template = await fs.promises.readFile(
+ path.join(
+ __dirname,
+ 'fixtures',
+ 'ifStatementsOnSameLineSkipValidation.docx'
+ )
+ );
+
+ const result = await createReport(
+ {
+ noSandbox,
+ template,
+ data: { ranges: [1, 2, 3, 4, 5] },
+ cmdDelimiter: ['{{', '}}'],
+ allowNestedIf: true,
+ },
+ 'XML'
+ );
+ expect(result).toMatchSnapshot();
+ });
+
it('Dynamic table columns', async () => {
const template = await fs.promises.readFile(
path.join(__dirname, 'fixtures', 'dynamic-columns.docx')
diff --git a/src/main.ts b/src/main.ts
index 5749068..87f5ad4 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -166,6 +166,7 @@ async function createReport(
indentXml: options.indentXml ?? true,
preserveSpace: options.preserveSpace ?? true,
compressionLevel: options.compressionLevel ?? 1,
+ allowNestedIf: options.allowNestedIf ?? false,
};
const xmlOptions = {
literalXmlDelimiter,
@@ -351,6 +352,7 @@ export async function listCommands(
indentXml: true,
preserveSpace: true,
compressionLevel: 1,
+ allowNestedIf: false,
};
const { jsTemplate, mainDocument, zip } = await parseTemplate(template);
diff --git a/src/processTemplate.ts b/src/processTemplate.ts
index f617237..9077ad3 100755
--- a/src/processTemplate.ts
+++ b/src/processTemplate.ts
@@ -826,7 +826,7 @@ const processForIf = async (
const curLoop = getCurLoop(ctx);
if (!(curLoop && curLoop.varName === varName)) {
// Check whether we already started a nested IF without and END-IF for this p or tr tag
- if (isIf) {
+ if (isIf && !ctx.options.allowNestedIf) {
const parentPorTrNode = findParentPorTrNode(node);
const parentPorTrNodeTag =
parentPorTrNode != null
diff --git a/src/types.ts b/src/types.ts
index 608fce2..015568b 100755
--- a/src/types.ts
+++ b/src/types.ts
@@ -145,6 +145,14 @@ export type UserOptions = {
* (Default: 1)
*/
compressionLevel?: number;
+ /**
+ * Whether to allow nested IF commands within the same paragraph or table row.
+ * By default (false), the library throws an error when it detects an IF command
+ * nested within another IF command on the same line or table row.
+ * Set to true to skip this validation check.
+ * (Default: false)
+ */
+ allowNestedIf?: boolean;
};
export type CreateReportOptions = {
@@ -163,6 +171,7 @@ export type CreateReportOptions = {
indentXml: boolean;
preserveSpace: boolean;
compressionLevel: number;
+ allowNestedIf: boolean;
};
export type SandBox = {