Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

docxtemplater

Package Overview
Dependencies
Maintainers
1
Versions
319
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docxtemplater - npm Package Compare versions

Comparing version 3.42.4 to 3.42.5

4

.eslint-rules/sortable.js

@@ -248,4 +248,4 @@ const naturalCompare = require("natural-compare");

: prev
? prev.range[1]
: commentsBefore[0].range[0];
? prev.range[1]
: commentsBefore[0].range[0];
const e = commentsBefore[commentsBefore.length - 1].range[1];

@@ -252,0 +252,0 @@ fixes.push(fixer.replaceTextRange([b, e], ""));

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
/* eslint-disable no-console */

@@ -11,0 +11,0 @@ module.exports = /*#__PURE__*/function () {

@@ -10,4 +10,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var DocUtils = require("./doc-utils.js");

@@ -14,0 +14,0 @@ DocUtils.traits = require("./traits.js");

@@ -7,4 +7,4 @@ "use strict";

function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("./utils.js"),

@@ -11,0 +11,0 @@ last = _require.last,

@@ -10,4 +10,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("lodash"),

@@ -14,0 +14,0 @@ merge = _require.merge,

@@ -13,4 +13,4 @@ "use strict";

function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("./errors.js"),

@@ -380,3 +380,3 @@ getUnclosedTagException = _require.getUnclosedTagException,

}
function decodeContentParts(xmlparsed) {
function decodeContentParts(xmlparsed, fileType) {
var inTextTag = false;

@@ -388,3 +388,3 @@ xmlparsed.forEach(function (part) {

}
if (isInsideContent(part)) {
if (fileType !== "text" && isInsideContent(part)) {
part.value = part.value.replace(/>/g, ">");

@@ -396,5 +396,9 @@ }

parseDelimiters: parseDelimiters,
parse: function parse(xmlparsed, delimiters, syntaxOptions) {
decodeContentParts(xmlparsed);
var _parseDelimiters = parseDelimiters(getContentParts(xmlparsed), delimiters, syntaxOptions),
parse: function parse(_ref) {
var xmllexed = _ref.xmllexed,
delimiters = _ref.delimiters,
syntax = _ref.syntax,
fileType = _ref.fileType;
decodeContentParts(xmllexed, fileType);
var _parseDelimiters = parseDelimiters(getContentParts(xmllexed), delimiters, syntax),
delimiterParsed = _parseDelimiters.parsed,

@@ -405,3 +409,3 @@ errors = _parseDelimiters.errors;

var lIndex = 0;
xmlparsed.forEach(function (part) {
xmllexed.forEach(function (part) {
if (isInsideContent(part)) {

@@ -408,0 +412,0 @@ Array.prototype.push.apply(lexed, delimiterParsed[index].map(function (p) {

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var wrapper = require("../module-wrapper.js");

@@ -11,0 +11,0 @@ var filetypes = require("../filetypes.js");

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var traitName = "expandPair";

@@ -11,0 +11,0 @@ var mergeSort = require("../merge-sort.js");

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("../doc-utils.js"),

@@ -11,0 +11,0 @@ setSingleAttribute = _require.setSingleAttribute,

@@ -20,4 +20,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("../doc-utils.js"),

@@ -24,0 +24,0 @@ chunkBy = _require.chunkBy,

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var traits = require("../traits.js");

@@ -11,0 +11,0 @@ var _require = require("../doc-utils.js"),

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var wrapper = require("../module-wrapper.js");

@@ -95,3 +95,4 @@ var _require = require("../errors.js"),

linebreaks = _ref.linebreaks,
nullGetter = _ref.nullGetter;
nullGetter = _ref.nullGetter,
fileType = _ref.fileType;
if (linebreaks && [settingsContentType, coreContentType, appContentType, customContentType].indexOf(contentType) !== -1) {

@@ -129,2 +130,7 @@ // Fixes issue tested in #docprops-linebreak

}
if (fileType === "text") {
return {
value: value
};
}
return {

@@ -131,0 +137,0 @@ value: linebreaks && typeof value === "string" ? this.renderLineBreaks(value) : utf8ToWord(value)

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var wrapper = require("../module-wrapper.js");

@@ -11,0 +11,0 @@ var _require = require("../doc-utils.js"),

@@ -7,4 +7,4 @@ "use strict";

function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

@@ -11,0 +11,0 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("./errors.js"),

@@ -11,0 +11,0 @@ getScopeParserExecutionError = _require.getScopeParserExecutionError;

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function logContext(parsed, i) {

@@ -11,0 +11,0 @@ var context = parsed.slice(i - 2, i + 2);

@@ -6,5 +6,3 @@ "use strict";

var _require2 = require("../utils.js"),
createDoc = _require2.createDoc,
createDocV4 = _require2.createDocV4,
shouldBeSame = _require2.shouldBeSame,
expect = _require2.expect,

@@ -16,66 +14,57 @@ resolveSoon = _require2.resolveSoon,

it("should render the document correctly in async mode", function () {
var doc = createDoc("office365.docx");
doc.setOptions({
paragraphLoop: true
return this.render({
async: true,
name: "office365.docx",
data: {
test: resolveSoon("Value"),
test2: "Value2"
},
options: {
paragraphLoop: true
},
expectedName: "expected-office365.docx",
expectedText: "Value Value2"
});
doc.compile();
return doc.resolveData({
test: resolveSoon("Value"),
test2: "Value2"
}).then(function () {
doc.render();
expect(doc.getFullText()).to.be.equal("Value Value2");
shouldBeSame({
doc: doc,
expectedName: "expected-office365.docx"
});
});
});
it("should work at parent level", function () {
var doc = createDoc("office365.docx");
doc.setOptions({
paragraphLoop: true
return this.render({
name: "office365.docx",
data: resolveSoon({
test: resolveSoon("Value"),
test2: "Value2"
}),
options: {
paragraphLoop: true
},
expectedName: "expected-office365.docx",
async: true,
expectedText: "Value Value2"
});
doc.compile();
return doc.resolveData(resolveSoon({
test: resolveSoon("Value"),
test2: "Value2"
})).then(function () {
doc.render();
expect(doc.getFullText()).to.be.equal("Value Value2");
shouldBeSame({
doc: doc,
expectedName: "expected-office365.docx"
});
});
});
it("should resolve loops", function () {
var doc = createDoc("multi-loop.docx");
doc.setOptions({
paragraphLoop: true
});
doc.compile();
return doc.resolveData({
companies: resolveSoon([{
name: "Acme",
users: resolveSoon([{
name: resolveSoon("John", 25)
return this.render({
name: "multi-loop.docx",
data: {
companies: resolveSoon([{
name: "Acme",
users: resolveSoon([{
name: resolveSoon("John", 25)
}, resolveSoon({
name: "James"
})], 5)
}, resolveSoon({
name: "James"
})], 5)
}, resolveSoon({
name: resolveSoon("Emca"),
users: resolveSoon([{
name: "Mary"
}, {
name: "Liz"
}])
}, 20)]),
test2: "Value2"
}).then(function () {
doc.render();
shouldBeSame({
doc: doc,
expectedName: "expected-multi-loop.docx"
});
name: resolveSoon("Emca"),
users: resolveSoon([{
name: "Mary"
}, {
name: "Liz"
}])
}, 20)]),
test2: "Value2"
},
options: {
paragraphLoop: true
},
expectedName: "expected-multi-loop.docx",
async: true
});

@@ -168,7 +157,5 @@ });

it("should not regress with nested loops sync", function () {
var doc = createDoc("regression-complex-loops.docx");
doc.compile();
doc.render(dataNestedLoops);
shouldBeSame({
doc: doc,
return this.render({
name: "regression-complex-loops.docx",
data: dataNestedLoops,
expectedName: "expected-regression-complex-loops.docx"

@@ -178,6 +165,4 @@ });

it("should not regress when having [Content_Types.xml] contain Default instead of Override", function () {
var doc = createDoc("with-default-contenttype.docx");
doc.render();
shouldBeSame({
doc: doc,
return this.render({
name: "with-default-contenttype.docx",
expectedName: "expected-with-default-contenttype.docx"

@@ -187,8 +172,7 @@ });

it("should not regress with nested loops async", function () {
var doc = createDocV4("regression-complex-loops.docx");
return doc.renderAsync(dataNestedLoops).then(function () {
shouldBeSame({
doc: doc,
expectedName: "expected-regression-complex-loops.docx"
});
return this.renderV4({
name: "regression-complex-loops.docx",
data: dataNestedLoops,
expectedName: "expected-regression-complex-loops.docx",
async: true
});

@@ -207,6 +191,5 @@ });

it("should not regress with multiple loops sync", function () {
var doc = createDocV4("regression-loops-resolve.docx");
doc.render(regressData);
shouldBeSame({
doc: doc,
return this.renderV4({
name: "regression-loops-resolve.docx",
data: regressData,
expectedName: "expected-regression-loops-resolve.docx"

@@ -216,62 +199,60 @@ });

it("should not regress with multiple loops async", function () {
var doc = createDocV4("regression-loops-resolve.docx");
return doc.renderAsync(regressData).then(function () {
shouldBeSame({
doc: doc,
expectedName: "expected-regression-loops-resolve.docx"
});
return this.renderV4({
name: "regression-loops-resolve.docx",
data: regressData,
expectedName: "expected-regression-loops-resolve.docx"
});
});
it("should not regress with long file (hit maxCompact value of 65536)", function () {
var doc = createDocV4("regression-loops-resolve.docx", {
paragraphLoop: true
return this.renderV4({
name: "regression-loops-resolve.docx",
data: {
amount_wheels_car_1: "4",
amount_wheels_motorcycle_1: "2",
amount_wheels_car_2: "6",
amount_wheels_motorcycle_2: "3",
id: [{
car: "1",
motorcycle: "2"
}, {
car: "2",
motorcycle: "3"
}, {
car: "4",
motorcycle: "5"
}, {
car: "4",
motorcycle: "5"
}]
},
options: {
paragraphLoop: true
},
expectedName: "expected-regression-loops-resolve-long.docx",
async: true
});
return doc.renderAsync({
amount_wheels_car_1: "4",
amount_wheels_motorcycle_1: "2",
amount_wheels_car_2: "6",
amount_wheels_motorcycle_2: "3",
id: [{
car: "1",
motorcycle: "2"
}, {
car: "2",
motorcycle: "3"
}, {
car: "4",
motorcycle: "5"
}, {
car: "4",
motorcycle: "5"
}]
}).then(function () {
shouldBeSame({
doc: doc,
expectedName: "expected-regression-loops-resolve-long.docx"
});
});
});
it("should deduplicate a16:rowId tag", function () {
var doc = createDocV4("a16-row-id.pptx");
return doc.renderAsync({
loop: [1, 2, 3, 4]
}).then(function () {
shouldBeSame({
doc: doc,
expectedName: "expected-a16-row-id.pptx"
});
return this.renderV4({
name: "a16-row-id.pptx",
data: {
loop: [1, 2, 3, 4]
},
expectedName: "expected-a16-row-id.pptx",
async: true
});
});
it("should work with fix doc pr corruption", function () {
this.name = "loop-image.docx";
this.options = {
modules: [fixDocPrCorruption]
};
this.data = {
loop: [1, 2, 3, 4]
};
this.expectedName = "expected-loop-images.docx";
this.async = true;
return this.renderV4();
return this.renderV4({
name: "loop-image.docx",
options: {
modules: [fixDocPrCorruption]
},
data: {
loop: [1, 2, 3, 4]
},
expectedName: "expected-loop-images.docx",
async: true
});
});
});

@@ -7,4 +7,4 @@ "use strict";

function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }

@@ -27,4 +27,3 @@ var PizZip = require("pizzip");

getLength = _require3.getLength,
getZip = _require3.getZip,
shouldBeSame = _require3.shouldBeSame;
getZip = _require3.getZip;
var inspectModule = require("../../inspect-module.js");

@@ -938,11 +937,10 @@ describe("Loading", function () {

it("should work when tag spans multiple lines (paragraphs)", function () {
var doc = createDoc("tag-spanning-multiline.docx");
doc.render({
first_name: "Hipp",
last_name: "Edgar",
phone: "0652455478",
description: "New Website"
});
shouldBeSame({
doc: doc,
return this.render({
name: "tag-spanning-multiline.docx",
data: {
first_name: "Hipp",
last_name: "Edgar",
phone: "0652455478",
description: "New Website"
},
expectedName: "expected-tag-spanning-multiline.docx"

@@ -949,0 +947,0 @@ });

@@ -32,12 +32,11 @@ "use strict";

it("should change custom values inside '<vt:lpwstr>' in file docProps/custom.xml", function () {
var doc = createDoc("tag-docprops-in-doc.docx");
doc.render({
first_name: "Hipp",
email: "john@acme.com",
last_name: "Edgar",
phone: "0652455478",
description: "New Website"
});
shouldBeSame({
doc: doc,
return this.render({
name: "tag-docprops-in-doc.docx",
data: {
first_name: "Hipp",
email: "john@acme.com",
last_name: "Edgar",
phone: "0652455478",
description: "New Website"
},
expectedName: "expected-tag-docprops-in-doc.docx"

@@ -44,0 +43,0 @@ });

@@ -7,5 +7,3 @@ "use strict";

rejectSoon = _require.rejectSoon,
expect = _require.expect,
shouldBeSame = _require.shouldBeSame,
createDocV4 = _require.createDocV4;
expect = _require.expect;
var Errors = require("../../errors.js");

@@ -66,3 +64,5 @@ var _require2 = require("../utils.js"),

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, wrapMultiError(expectedError));

@@ -83,3 +83,4 @@ });

};
var capture = expectToThrow(function () {
var capture = captureLogs();
expectToThrow(function () {
return makeDocxV4(content, {

@@ -89,2 +90,3 @@ errorLogging: false

}, Errors.XTTemplateError, wrapMultiError(expectedError));
capture.stop();
var logs = capture.logs();

@@ -107,3 +109,5 @@ expect(logs.length).to.equal(0);

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, wrapMultiError(expectedError));

@@ -125,3 +129,5 @@ });

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, wrapMultiError(expectedError));

@@ -142,3 +148,5 @@ });

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, wrapMultiError(expectedError));

@@ -159,3 +167,5 @@ });

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, wrapMultiError(expectedError));

@@ -176,3 +186,5 @@ });

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, wrapMultiError(expectedError));

@@ -183,3 +195,5 @@ });

expectToThrowSnapshot(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
});

@@ -190,3 +204,5 @@ });

expectToThrowSnapshot(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
});

@@ -197,3 +213,5 @@ });

expectToThrowSnapshot(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
});

@@ -215,3 +233,5 @@ });

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, wrapMultiError(expectedError));

@@ -222,3 +242,5 @@ });

expectToThrowSnapshot(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
});

@@ -242,3 +264,4 @@ });

return makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
});

@@ -280,3 +303,4 @@ }, Errors.XTTemplateError, wrapMultiError(expectedError));

return makeDocxV4(content, {
parser: errorParser
parser: errorParser,
errorLogging: false
}).render();

@@ -360,3 +384,4 @@ }, Errors.XTTemplateError, expectedError);

var doc = makeDocxV4(content, {
parser: errorParser
parser: errorParser,
errorLogging: false
});

@@ -433,3 +458,5 @@ expectToThrow(function () {

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, expectedError);

@@ -440,3 +467,5 @@ });

expectToThrowSnapshot(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
});

@@ -471,3 +500,5 @@ });

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, expectedError);

@@ -504,3 +535,5 @@ });

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, expectedError);

@@ -511,3 +544,5 @@ });

expectToThrowSnapshot(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
});

@@ -551,3 +586,5 @@ });

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, expectedError);

@@ -591,3 +628,4 @@ });

return makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
});

@@ -630,3 +668,4 @@ }, Errors.XTTemplateError, expectedError);

return makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
});

@@ -667,3 +706,4 @@ }, Errors.XTTemplateError, expectedError);

return makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
});

@@ -702,3 +742,4 @@ }, Errors.XTTemplateError, expectedError);

return makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
});

@@ -752,3 +793,4 @@ }, Errors.XTTemplateError, expectedError);

return makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
});

@@ -799,3 +841,4 @@ }, Errors.XTTemplateError, expectedError);

return makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
});

@@ -843,3 +886,4 @@ }, Errors.XTTemplateError, expectedError);

return makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
});

@@ -869,3 +913,4 @@ }, Errors.XTTemplateError, expectedError);

return makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
});

@@ -904,3 +949,5 @@ }, Errors.XTTemplateError, expectedError);

expectToThrow(function () {
return makeDocxV4(content);
return makeDocxV4(content, {
errorLogging: false
});
}, Errors.XTTemplateError, expectedError);

@@ -940,3 +987,4 @@ });

makeDocxV4(content, {
parser: angularParser
parser: angularParser,
errorLogging: false
}).render({

@@ -966,3 +1014,5 @@ user: String.fromCharCode(28)

};
var doc = makeDocxV4(content);
var doc = makeDocxV4(content, {
errorLogging: false
});
function create() {

@@ -1034,3 +1084,4 @@ return doc.renderAsync({

var doc = makeDocxV4(content, {
parser: errorParser
parser: errorParser,
errorLogging: false
});

@@ -1111,3 +1162,4 @@ return expectToThrowAsync(function () {

var doc = makeDocxV4(content, {
parser: errorParser
parser: errorParser,
errorLogging: false
});

@@ -1171,3 +1223,4 @@ function create() {

var doc = makeDocxV4(content, {
parser: errorParser
parser: errorParser,
errorLogging: false
});

@@ -1183,4 +1236,9 @@ return expectToThrowAsync(function () {

it("should be possible to allow unopened tag if syntax.allowUnopenedTag is true", function () {
shouldBeSame({
doc: createDocV4("bug-closing-placeholder-orphan.docx", {
return this.renderV4({
name: "bug-closing-placeholder-orphan.docx",
data: {
first_name: "John",
last_name: "Doe"
},
options: {
delimiters: {

@@ -1193,6 +1251,3 @@ start: "$(",

}
}).render({
first_name: "John",
last_name: "Doe"
}),
},
expectedName: "expected-bug-closing-placeholder-orphan.docx"

@@ -1199,0 +1254,0 @@ });

@@ -7,4 +7,4 @@ "use strict";

function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("lodash"),

@@ -11,0 +11,0 @@ assign = _require.assign;

@@ -158,4 +158,4 @@ "use strict";

it("should not escape tab character", function () {
shouldBeSame({
doc: createDocV4("tab-character.pptx").render(),
return this.renderV4({
name: "tab-character.pptx",
expectedName: "expected-tab-character.pptx"

@@ -165,25 +165,24 @@ });

it("should not double escape loop containing hebrew", function () {
var tags = {
title: "Default title",
products: [{
title: "Duk",
name: "DukSoftware",
reference: "DS0"
}, {
title: "Tingerloo",
name: "Tingerlee",
reference: "T00"
}, {
title: "Tingerloo",
name: "Tingerlee",
reference: "T00"
}, {
title: "Tingerloo",
name: "Tingerlee",
reference: "T00"
}]
};
var doc = createDocV4("loop-hebrew.docx").render(tags);
shouldBeSame({
doc: doc,
return this.renderV4({
name: "loop-hebrew.docx",
data: {
title: "Default title",
products: [{
title: "Duk",
name: "DukSoftware",
reference: "DS0"
}, {
title: "Tingerloo",
name: "Tingerlee",
reference: "T00"
}, {
title: "Tingerloo",
name: "Tingerlee",
reference: "T00"
}, {
title: "Tingerloo",
name: "Tingerlee",
reference: "T00"
}]
},
expectedName: "expected-loop-hebrew.docx"

@@ -195,7 +194,5 @@ });

it("should not corrupt when having sdt content", function () {
var tags = {};
var doc = createDocV4("sdt-content.docx");
doc.render(tags);
shouldBeSame({
doc: doc,
return this.renderV4({
name: "sdt-content.docx",
data: {},
expectedName: "expected-sdt-content.docx"

@@ -206,14 +203,13 @@ });

// Fixed in version 3.40.3
var tags = {
title: "Foo\nBar\nBaz",
creator: "Foo\nBar\nBaz",
lmb: "Foo\nBar\nBaz"
};
var doc = createDocV4("tag-in-title.pptx", {
paragraphLoop: true,
linebreaks: true
});
doc.render(tags);
shouldBeSame({
doc: doc,
return this.render({
data: {
title: "Foo\nBar\nBaz",
creator: "Foo\nBar\nBaz",
lmb: "Foo\nBar\nBaz"
},
name: "tag-in-title.pptx",
options: {
paragraphLoop: true,
linebreaks: true
},
expectedName: "expected-tag-in-title.pptx"

@@ -236,9 +232,10 @@ });

it("should be possible to have linebreaks if setting the option", function () {
var doc = createDoc("tag-multiline.docx").setOptions({
linebreaks: true
}).render({
description: "The description,\nmultiline"
});
shouldBeSame({
doc: doc,
return this.render({
name: "tag-multiline.docx",
options: {
linebreaks: true
},
data: {
description: "The description,\nmultiline"
},
expectedName: "expected-multiline.docx"

@@ -248,5 +245,4 @@ });

it("should not remove section if having normal loop just before", function () {
var doc = createDoc("loop-with-section-break-after.docx").render();
shouldBeSame({
doc: doc,
return this.render({
name: "loop-with-section-break-after.docx",
expectedName: "expected-loop-with-section-break-after.docx"

@@ -256,42 +252,45 @@ });

it("should not remove section if having paragraph loop just before", function () {
var doc = createDoc("paragraph-loop-with-section-break-after.docx").setOptions({
paragraphLoop: true
}).render();
shouldBeSame({
doc: doc,
expectedName: "expected-paragraph-loop-with-section-break-after.docx"
return this.render({
name: "paragraph-loop-with-section-break-after.docx",
options: {
paragraphLoop: true
},
expectedName: "paragraph-loop-with-section-break-after.docx"
});
});
it("should work with linebreaks and copy the run style onto new lines in docx", function () {
this.name = "multi-tags.docx";
this.options = {
linebreaks: true
};
this.data = {
test: "The tag1,\nmultiline\nfoobaz",
test2: "The tag2,\nmultiline\nfoobar"
};
this.async = true;
this.expectedName = "expected-two-multiline.docx";
return this.renderV4();
return this.renderV4({
name: "multi-tags.docx",
options: {
linebreaks: true
},
data: {
test: "The tag1,\nmultiline\nfoobaz",
test2: "The tag2,\nmultiline\nfoobar"
},
async: true,
expectedName: "expected-two-multiline.docx"
});
});
it("should work with linebreaks and copy the run style onto new lines in pptx", function () {
this.name = "tag-multiline.pptx";
this.options = {
linebreaks: true
};
this.data = {
description: "The description,\nmultiline"
};
this.expectedName = "expected-multiline.pptx";
return this.render();
return this.render({
name: "tag-multiline.pptx",
options: {
linebreaks: true
},
data: {
description: "The description,\nmultiline"
},
expectedName: "expected-multiline.pptx"
});
});
it("should not fail when using linebreaks and tagvalue not a string", function () {
var doc = createDoc("tag-multiline.pptx").setOptions({
linebreaks: true
}).render({
description: true
});
shouldBeSame({
doc: doc,
return this.render({
name: "tag-multiline.pptx",
options: {
linebreaks: true
},
data: {
description: true
},
expectedName: "expected-regression-multiline.pptx"

@@ -301,13 +300,13 @@ });

it("should drop empty lines found inside the tags", function () {
var doc = createDocV4("tag-spanning-multiple-lines.docx", {
parser: function parser() {
return {
get: function get() {
return "";
}
};
}
}).render();
shouldBeSame({
doc: doc,
return this.renderV4({
name: "tag-spanning-multiple-lines.docx",
options: {
parser: function parser() {
return {
get: function get() {
return "";
}
};
}
},
expectedName: "expected-no-multiline.docx"

@@ -317,13 +316,13 @@ });

it("should drop empty lines found inside the tags", function () {
var doc = createDocV4("tag-spanning-multiple-lines.pptx", {
parser: function parser() {
return {
get: function get() {
return "";
}
};
}
}).render();
shouldBeSame({
doc: doc,
return this.renderV4({
name: "tag-spanning-multiple-lines.pptx",
options: {
parser: function parser() {
return {
get: function get() {
return "";
}
};
}
},
expectedName: "expected-no-multiline.pptx"

@@ -333,9 +332,10 @@ });

it("should keep run props (font-size) for pptx file", function () {
var doc = createDocV4("run-props-linebreak.pptx", {
linebreaks: true
}).render({
data: "blabla\nbloblo\nblublu"
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "run-props-linebreak.pptx",
data: {
data: "blabla\nbloblo\nblublu"
},
options: {
linebreaks: true
},
expectedName: "expected-run-props-linebreak.pptx"

@@ -347,7 +347,7 @@ });

it("should be possible to template values in comments", function () {
var doc = createDocV4("with-comments.docx").render({
name: "John"
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "with-comments.docx",
data: {
name: "John"
},
expectedName: "expected-comments.docx"

@@ -359,11 +359,12 @@ });

it("should be possible to assign a value from the template", function () {
var doc = createDoc("assignment.docx").setOptions({
paragraphLoop: true,
parser: angularParser
}).render({
first_name: "Jane",
last_name: "Doe"
});
shouldBeSame({
doc: doc,
return this.render({
name: "assignment.docx",
data: {
first_name: "Jane",
last_name: "Doe"
},
options: {
paragraphLoop: true,
parser: angularParser
},
expectedName: "expected-assignment.docx"

@@ -375,7 +376,7 @@ });

it("should work with docm", function () {
var doc = createDoc("input.docm").render({
user: "John"
});
shouldBeSame({
doc: doc,
return this.render({
name: "input.docm",
data: {
user: "John"
},
expectedName: "expected-docm.docm"

@@ -385,7 +386,7 @@ });

it("should work with pptm", function () {
var doc = createDoc("input.pptm").render({
user: "John"
});
shouldBeSame({
doc: doc,
return this.render({
name: "input.pptm",
data: {
user: "John"
},
expectedName: "expected-pptm.pptm"

@@ -395,7 +396,7 @@ });

it("should work with dotx", function () {
var doc = createDoc("input.dotx").render({
user: "John"
});
shouldBeSame({
doc: doc,
return this.render({
name: "input.dotx",
data: {
user: "John"
},
expectedName: "expected-dotx.dotx"

@@ -405,7 +406,7 @@ });

it("should work with dotm", function () {
var doc = createDoc("input.dotm").render({
user: "John"
});
shouldBeSame({
doc: doc,
return this.render({
name: "input.dotm",
data: {
user: "John"
},
expectedName: "expected-dotm.dotm"

@@ -477,5 +478,4 @@ });

it("should not corrupt document if using empty {-a:p} inside table cell", function () {
var doc = createDoc("regression-dash-loop-in-table-cell.pptx").render();
shouldBeSame({
doc: doc,
return this.render({
name: "regression-dash-loop-in-table-cell.pptx",
expectedName: "expected-table-3-cells.pptx"

@@ -485,7 +485,7 @@ });

it("should not corrupt document if using empty {-a:p} inside table cell", function () {
var doc = createDoc("regression-dash-loop-in-table-cell.pptx").render({
cond: [1, 2, 3]
});
shouldBeSame({
doc: doc,
return this.render({
name: "regression-dash-loop-in-table-cell.pptx",
data: {
cond: [1, 2, 3]
},
expectedName: "expected-table-3-true-cells.pptx"

@@ -498,9 +498,10 @@ });

// Warning : In libreoffice, this is not rendered correctly, use WPS or Word
var doc = createDocV4("page-break-inside-condition.docx", {
paragraphLoop: true
}).render({
cond: [1, 2, 3]
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "page-break-inside-condition.docx",
data: {
cond: [1, 2, 3]
},
options: {
paragraphLoop: true
},
expectedName: "expected-with-page-break-3-els.docx"

@@ -511,9 +512,10 @@ });

// Warning : In libreoffice, this is not rendered correctly, use WPS or Word
var doc = createDocV4("page-break-inside-condition.docx", {
paragraphLoop: true
}).render({
cond: false
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "page-break-inside-condition.docx",
data: {
cond: false
},
options: {
paragraphLoop: true
},
expectedName: "expected-with-page-break-falsy.docx"

@@ -524,7 +526,7 @@ });

// Warning : In libreoffice, this is not rendered correctly, use WPS or Word
var doc = createDoc("page-break-inside-condition.docx").render({
cond: false
});
shouldBeSame({
doc: doc,
return this.render({
name: "page-break-inside-condition.docx",
data: {
cond: false
},
expectedName: "expected-page-break-falsy-std-loop.docx"

@@ -535,7 +537,7 @@ });

// Warning : In libreoffice, this is not rendered correctly, use WPS or Word
var doc = createDoc("page-break-inside-condition.docx").render({
cond: [1, 2, 3]
});
shouldBeSame({
doc: doc,
return this.render({
name: "page-break-inside-condition.docx",
data: {
cond: [1, 2, 3]
},
expectedName: "expected-page-break-3-els-std-loop.docx"

@@ -546,7 +548,7 @@ });

// Warning : In libreoffice, this is not rendered correctly, use WPS or Word
var doc = createDoc("page-break-inside-condition.docx").render({
cond: true
});
shouldBeSame({
doc: doc,
return this.render({
name: "page-break-inside-condition.docx",
data: {
cond: true
},
expectedName: "expected-page-break-truthy-std-loop.docx"

@@ -556,9 +558,10 @@ });

it("should work with table inside paragraph loop", function () {
var doc = createDocV4("pagebreak-table-loop.docx", {
paragraphLoop: true
}).render({
loop: [1, 2, 3]
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "pagebreak-table-loop.docx",
options: {
paragraphLoop: true
},
data: {
loop: [1, 2, 3]
},
expectedName: "expected-pagebreak-table-loop.docx"

@@ -568,13 +571,13 @@ });

it("should work at end of std loop", function () {
var doc = createDoc("paragraph-loop-with-pagebreak.docx").render({
users: [{
name: "Bar"
}, {
name: "John"
}, {
name: "Baz"
}]
});
shouldBeSame({
doc: doc,
return this.render({
name: "paragraph-loop-with-pagebreak.docx",
data: {
users: [{
name: "Bar"
}, {
name: "John"
}, {
name: "Baz"
}]
},
expectedName: "expected-noparagraph-loop-with-pagebreak.docx"

@@ -584,15 +587,16 @@ });

it("should work at end of paragraph loop", function () {
var doc = createDocV4("paragraph-loop-with-pagebreak.docx", {
paragraphLoop: true
}).render({
users: [{
name: "Bar"
}, {
name: "John"
}, {
name: "Baz"
}]
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "paragraph-loop-with-pagebreak.docx",
options: {
paragraphLoop: true
},
data: {
users: [{
name: "Bar"
}, {
name: "John"
}, {
name: "Baz"
}]
},
expectedName: "expected-paragraph-loop-with-pagebreak.docx"

@@ -602,9 +606,10 @@ });

it("should work with pagebreak afterwards with falsy value", function () {
var doc = createDocV4("paragraph-loop-with-pagebreak.docx", {
paragraphLoop: true
}).render({
users: false
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "paragraph-loop-with-pagebreak.docx",
options: {
paragraphLoop: true
},
data: {
users: false
},
expectedName: "expected-paragraph-loop-empty-with-pagebreak.docx"

@@ -614,10 +619,11 @@ });

it("should make first section break of the file continuous", function () {
var doc = createDocV4("loop-with-continuous-section-break.docx", {
paragraphLoop: true,
parser: angularParser
}).render({
loop: [1, 2, 3]
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "loop-with-continuous-section-break.docx",
data: {
loop: [1, 2, 3]
},
options: {
paragraphLoop: true,
parser: angularParser
},
expectedName: "expected-loop-with-continuous-section-break.docx"

@@ -627,13 +633,14 @@ });

it("should work with delimiters << >> when saved in word as &gt;&gt;test>>", function () {
var doc = createDocV4("gt-delimiters.docx", {
parser: angularParser,
delimiters: {
start: "<<",
end: ">>"
}
}).render({
my_tag: "Hello John"
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "gt-delimiters.docx",
data: {
my_tag: "Hello John"
},
options: {
parser: angularParser,
delimiters: {
start: "<<",
end: ">>"
}
},
expectedName: "expected-rendered-hello.docx"

@@ -643,11 +650,12 @@ });

it("should work with quotes in tag with angular parser", function () {
var doc = createDocV4("quotes-in-tag.docx", {
parser: angularParser,
paragraphLoop: true
}).render({
user: "John",
hobbies: ["hiking", "reading"]
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "quotes-in-tag.docx",
data: {
user: "John",
hobbies: ["hiking", "reading"]
},
options: {
parser: angularParser,
paragraphLoop: true
},
expectedName: "expected-quotes-in-tag.docx"

@@ -657,9 +665,10 @@ });

it("should make first section break of the file continuous", function () {
var doc = createDocV4("loop-with-continuous-section-break.docx", {
parser: angularParser
}).render({
loop: [1, 2, 3]
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "loop-with-continuous-section-break.docx",
data: {
loop: [1, 2, 3]
},
options: {
parser: angularParser
},
expectedName: "expected-loop-with-continuous-section-break-2.docx"

@@ -669,9 +678,10 @@ });

it('should work with w:type val="nextPage" section break', function () {
var doc = createDocV4("nextpage-section-break.docx", {
paragraphLoop: true
}).render({
items: [1, 2, 3, 4]
});
shouldBeSame({
doc: doc,
return this.render({
name: "nextpage-section-break.docx",
data: {
items: [1, 2, 3, 4]
},
options: {
paragraphLoop: true
},
expectedName: "expected-nextpage-section-break.docx"

@@ -683,9 +693,10 @@ });

it("should work with docx", function () {
var doc = createDoc("users.docx").setOptions({
paragraphLoop: true
}).render({
users: ["John", "Jane", "Louis"]
});
shouldBeSame({
doc: doc,
return this.render({
name: "users.docx",
data: {
users: ["John", "Jane", "Louis"]
},
options: {
paragraphLoop: true
},
expectedName: "expected-users.docx"

@@ -695,9 +706,10 @@ });

it("should not drop image with text", function () {
var doc = createDoc("cond-image.docx").setOptions({
paragraphLoop: true
}).render({
cond: true
});
shouldBeSame({
doc: doc,
return this.render({
name: "cond-image.docx",
data: {
cond: true
},
options: {
paragraphLoop: true
},
expectedName: "expected-cond-image.docx"

@@ -707,9 +719,10 @@ });

it("should not drop image without text", function () {
var doc = createDoc("cond-image-no-innertext.docx").setOptions({
paragraphLoop: true
}).render({
cond: true
});
shouldBeSame({
doc: doc,
return this.render({
name: "cond-image-no-innertext.docx",
data: {
cond: true
},
options: {
paragraphLoop: true
},
expectedName: "expected-cond-image-no-innertext.docx"

@@ -719,9 +732,10 @@ });

it("should not drop image without text at beginning", function () {
var doc = createDoc("cond-image-no-innertext-before.docx").setOptions({
paragraphLoop: true
}).render({
cond: true
});
shouldBeSame({
doc: doc,
return this.render({
name: "cond-image-no-innertext-before.docx",
data: {
cond: true
},
options: {
paragraphLoop: true
},
expectedName: "expected-cond-image-no-innertext-before.docx"

@@ -731,15 +745,16 @@ });

it("should work without removing extra text", function () {
var doc = createDoc("paragraph-loops.docx").setOptions({
paragraphLoop: true
}).render({
condition: [1, 2],
l1: [{
l2: ["a", "b", "c"]
}, {
l2: ["d", "e", "f"]
}],
placeholder: "placeholder-value"
});
shouldBeSame({
doc: doc,
return this.render({
name: "paragraph-loops.docx",
data: {
condition: [1, 2],
l1: [{
l2: ["a", "b", "c"]
}, {
l2: ["d", "e", "f"]
}],
placeholder: "placeholder-value"
},
options: {
paragraphLoop: true
},
expectedName: "expected-paragraph-loop.docx"

@@ -749,18 +764,19 @@ });

it("should work with pptx", function () {
var doc = createDoc("paragraph-loop.pptx").setOptions({
paragraphLoop: true
}).render({
users: [{
age: 10,
name: "Bar"
}, {
age: 18,
name: "Bar"
}, {
age: 22,
name: "Bar"
}]
});
shouldBeSame({
doc: doc,
return this.render({
name: "paragraph-loop.pptx",
data: {
users: [{
age: 10,
name: "Bar"
}, {
age: 18,
name: "Bar"
}, {
age: 22,
name: "Bar"
}]
},
options: {
paragraphLoop: true
},
expectedName: "expected-paragraph-loop.pptx"

@@ -784,4 +800,4 @@ });

it("should not produce corrupt document when having comment inside tag", function () {
shouldBeSame({
doc: createDocV4("tag-with-comment.docx").render(),
return this.renderV4({
name: "tag-with-comment.docx",
expectedName: "expected-tag-with-comment.docx"

@@ -822,9 +838,10 @@ });

it("should work with spacing at the end", function () {
var doc = createDoc("spacing-end.docx").setOptions({
paragraphLoop: true
}).render({
name: "John"
});
shouldBeSame({
doc: doc,
return this.render({
name: "spacing-end.docx",
data: {
name: "John"
},
options: {
paragraphLoop: true
},
expectedName: "expected-spacing-end.docx"

@@ -862,2 +879,3 @@ });

paragraphLoop: true,
errorLogging: false,
parser: angularParser

@@ -910,2 +928,3 @@ });

paragraphLoop: true,
errorLogging: false,
parser: angularParser

@@ -966,3 +985,5 @@ });

it("should fail when placing paragraph loop inside normal loop", function () {
var doc = createDoc("paragraph-loop-error.docx");
var doc = createDoc("paragraph-loop-error.docx", {
errorLogging: false
});
var expectedError = {

@@ -1097,20 +1118,21 @@ message: "Multi error",

it("should handle files with word/document2.xml", function () {
var doc = createDocV4("office365.docx", {
paragraphLoop: true
}).render({
test: "Value",
test2: "Value2"
return this.renderV4({
name: "office365.docx",
data: {
test: "Value",
test2: "Value2"
},
options: {
paragraphLoop: true
},
expectedName: "expected-office365.docx",
expectedText: "Value Value2"
});
expect(doc.getFullText()).to.be.equal("Value Value2");
shouldBeSame({
doc: doc,
expectedName: "expected-office365.docx"
});
});
it("should template header.xml (without digit like header1.xml)", function () {
var doc = createDoc("header-without-digit.docx").render({
name: "John"
});
shouldBeSame({
doc: doc,
return this.render({
name: "header-without-digit.docx",
data: {
name: "John"
},
expectedName: "expected-header-without-digit.docx"

@@ -1122,7 +1144,7 @@ });

it("should work with template", function () {
var doc = createDocV4("empty-loop-regression.docx").render({
ice: [1, 2, 3]
});
shouldBeSame({
doc: doc,
return this.renderV4({
name: "empty-loop-regression.docx",
data: {
ice: [1, 2, 3]
},
expectedName: "expected-loop-regression.docx"

@@ -1129,0 +1151,0 @@ });

@@ -7,4 +7,4 @@ "use strict";

function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("../utils.js"),

@@ -11,0 +11,0 @@ expect = _require.expect,

@@ -457,10 +457,12 @@ "use strict";

}
this.name = "tag-example.docx";
this.options = {
modules: [module1()]
};
this.data = {
first_name: "John"
};
expect(this.renderV4().getFullText()).to.equal("l28!! John");
expect(this.renderV4({
name: "tag-example.docx",
options: {
modules: [module1()]
},
data: {
first_name: "John"
},
expectedText: "l28!! John"
}));
});

@@ -673,11 +675,13 @@ it("should automatically choose module with longest value", function () {

};
this.name = "loop-image-footer.docx";
this.options = {
modules: [mod]
};
this.data = {
loop: [1, 2, 3, 4]
};
// This test will test the case where the fixDocPrCorruption is used on two different instances of the docxtemplater library
this.render();
this.render({
name: "loop-image-footer.docx",
options: {
modules: [mod]
},
data: {
loop: [1, 2, 3, 4]
}
});
expect(uniq(calls)).to.deep.equal(expectedCallOrder);

@@ -684,0 +688,0 @@ });

@@ -29,14 +29,13 @@ "use strict";

it("should work with table pptx", function () {
var doc = createDoc("table-example.pptx");
doc.setData({
users: [{
msg: "hello",
name: "mary"
}, {
msg: "hello",
name: "john"
}]
}).render();
shouldBeSame({
doc: doc,
return this.render({
name: "table-example.pptx",
data: {
users: [{
msg: "hello",
name: "mary"
}, {
msg: "hello",
name: "john"
}]
},
expectedName: "expected-table-example.pptx"

@@ -84,14 +83,13 @@ });

it("should work with loop pptx", function () {
var doc = createDoc("loop-example.pptx");
doc.setData({
users: [{
name: "Doe"
}, {
name: "John"
}]
}).render();
expect(doc.getFullText()).to.be.equal(" Doe John ");
shouldBeSame({
doc: doc,
expectedName: "expected-loop-example.pptx"
return this.render({
name: "loop-example.pptx",
data: {
users: [{
name: "Doe"
}, {
name: "John"
}]
},
expectedName: "expected-loop-example.pptx",
expectedText: " Doe John "
});

@@ -98,0 +96,0 @@ });

@@ -5,24 +5,23 @@ "use strict";

createDoc = _require.createDoc,
createDocV4 = _require.createDocV4,
shouldBeSame = _require.shouldBeSame,
expect = _require.expect;
describe("Table", function () {
it("should work with selfclosing tag inside table with paragraphLoop", function () {
var tags = {
a: [{
b: {
c: "Foo",
d: "Hello "
}
}, {
b: {
c: "Foo",
d: "Hello "
}
}]
};
shouldBeSame({
doc: createDocV4("loop-valid.docx", {
return this.renderV4({
name: "loop-valid.docx",
options: {
paragraphLoop: true
}).render(tags),
},
data: {
a: [{
b: {
c: "Foo",
d: "Hello "
}
}, {
b: {
c: "Foo",
d: "Hello "
}
}]
},
expectedName: "expected-loop-valid.docx"

@@ -32,28 +31,25 @@ });

it("should work with tables", function () {
var tags = {
clients: [{
first_name: "John",
last_name: "Doe",
phone: "+33647874513"
}, {
first_name: "Jane",
last_name: "Doe",
phone: "+33454540124"
}, {
first_name: "Phil",
last_name: "Kiel",
phone: "+44578451245"
}, {
first_name: "Dave",
last_name: "Sto",
phone: "+44548787984"
}]
};
var doc = createDoc("tag-intelligent-loop-table.docx").setData(tags).render();
var expectedText = "JohnDoe+33647874513JaneDoe+33454540124PhilKiel+44578451245DaveSto+44548787984";
var text = doc.getFullText();
expect(text).to.be.equal(expectedText);
shouldBeSame({
doc: doc,
expectedName: "expected-tag-intelligent-loop-table.docx"
return this.render({
data: {
clients: [{
first_name: "John",
last_name: "Doe",
phone: "+33647874513"
}, {
first_name: "Jane",
last_name: "Doe",
phone: "+33454540124"
}, {
first_name: "Phil",
last_name: "Kiel",
phone: "+44578451245"
}, {
first_name: "Dave",
last_name: "Sto",
phone: "+44548787984"
}]
},
name: "tag-intelligent-loop-table.docx",
expectedName: "expected-tag-intelligent-loop-table.docx",
expectedText: "JohnDoe+33647874513JaneDoe+33454540124PhilKiel+44578451245DaveSto+44548787984"
});

@@ -117,5 +113,4 @@ });

it("should not corrupt table with empty rawxml", function () {
var doc = createDoc("table-raw-xml.docx").render();
shouldBeSame({
doc: doc,
return this.render({
name: "table-raw-xml.docx",
expectedName: "expected-raw-xml.docx"

@@ -125,11 +120,11 @@ });

it("should call nullGetter with empty rawxml", function () {
var doc = createDocV4("table-raw-xml.docx", {
nullGetter: function nullGetter(part) {
if (part.module === "rawxml") {
return "<w:p>\n\t\t\t\t\t<w:r>\n\t\t\t\t\t\t<w:rPr><w:color w:val=\"FF0000\"/></w:rPr>\n\t\t\t\t\t\t<w:t>UNDEFINED</w:t>\n\t\t\t\t\t</w:r>\n\t\t\t\t\t</w:p>";
return this.renderV4({
name: "table-raw-xml.docx",
options: {
nullGetter: function nullGetter(part) {
if (part.module === "rawxml") {
return "<w:p>\n <w:r>\n <w:rPr><w:color w:val=\"FF0000\"/></w:rPr>\n <w:t>UNDEFINED</w:t>\n </w:r>\n </w:p>";
}
}
}
}).render();
shouldBeSame({
doc: doc,
},
expectedName: "expected-raw-xml-null.docx"

@@ -139,5 +134,4 @@ });

it("should not corrupt document with empty rawxml after a table, at the end of the document", function () {
var doc = createDoc("raw-xml-after-table.docx").render();
shouldBeSame({
doc: doc,
return this.render({
name: "raw-xml-after-table.docx",
expectedName: "expected-raw-xml-after-table.docx"

@@ -147,5 +141,4 @@ });

it("should not corrupt document with selfclosing w:sdtContent tag", function () {
var doc = createDoc("self-closing-w-sdtcontent.docx").render();
shouldBeSame({
doc: doc,
return this.render({
name: "self-closing-w-sdtcontent.docx",
expectedName: "expected-self-closing-w-sdtcontent.docx"

@@ -155,13 +148,13 @@ });

it("should not corrupt loop containing section", function () {
var doc = createDoc("loop-with-section.docx").render({
loop1: [{
loop2: [1, 2]
}, {
loop2: []
}, {
loop2: [3, 4, 5]
}]
});
shouldBeSame({
doc: doc,
return this.render({
name: "loop-with-section.docx",
data: {
loop1: [{
loop2: [1, 2]
}, {
loop2: []
}, {
loop2: [3, 4, 5]
}]
},
expectedName: "expected-multi-section.docx"

@@ -171,7 +164,7 @@ });

it("should repeat section break if the section break is inside a loop", function () {
var doc = createDoc("loop-with-page-section-break.docx").render({
loop: [1, 2, 3]
});
shouldBeSame({
doc: doc,
return this.render({
name: "loop-with-page-section-break.docx",
data: {
loop: [1, 2, 3]
},
expectedName: "expected-page-section-break.docx"

@@ -181,10 +174,10 @@ });

it("should not corrupt sdtcontent", function () {
var doc = createDoc("regression-sdtcontent-paragraph.docx").render({
loop: {
name: "foo",
Id: "bar"
}
});
shouldBeSame({
doc: doc,
return this.render({
name: "regression-sdtcontent-paragraph.docx",
data: {
loop: {
name: "foo",
Id: "bar"
}
},
expectedName: "expected-sdtcontent-valid.docx"

@@ -194,31 +187,30 @@ });

it("should not corrupt table with empty rawxml within loop", function () {
var doc = createDoc("loops-with-table-raw-xml.docx").setOptions({
paragraphLoop: true
}).render({
loop: [{
loop2: []
}, {
loop2: {},
raw: "<w:p><w:r><w:t>RAW</w:t></w:r></w:p>"
}]
});
shouldBeSame({
doc: doc,
return this.render({
name: "loops-with-table-raw-xml.docx",
options: {
paragraphLoop: true
},
data: {
loop: [{
loop2: []
}, {
loop2: {},
raw: "<w:p><w:r><w:t>RAW</w:t></w:r></w:p>"
}]
},
expectedName: "expected-loop-raw-xml.docx"
});
});
it("should not corrupt table with empty loop", function () {
var doc = createDoc("table-loop.docx").setOptions({
paragraphLoop: true
}).render();
shouldBeSame({
doc: doc,
expectedName: "expected-empty-table.docx"
it("should not corrupt document with selfclosing w:sdtContent tag", function () {
return this.render({
name: "self-closing-w-sdtcontent.docx",
expectedName: "expected-self-closing-w-sdtcontent.docx"
});
});
it("should not corrupt table because of missing <w:p> after table", function () {
shouldBeSame({
doc: createDocV4("table-in-table-corruption.docx", {
return this.renderV4({
name: "table-in-table-corruption.docx",
options: {
paragraphLoop: true
}).render(),
},
expectedName: "expected-table-in-table-corruption.docx"

@@ -228,4 +220,4 @@ });

it("should drop table if there are no <w:tr> childs", function () {
shouldBeSame({
doc: createDocV4("table-empty.docx").render(),
return this.renderV4({
name: "table-empty.docx",
expectedName: "expected-table-empty.docx"

@@ -232,0 +224,0 @@ });

"use strict";
var _require = require("../utils.js"),
expect = _require.expect;
expect = _require.expect,
expectToThrow = _require.expectToThrow,
wrapMultiError = _require.wrapMultiError;
var Errors = require("../../errors.js");
var expressionParser = require("../../expressions.js");

@@ -23,2 +26,11 @@ var TxtTemplater = require("../../text.js");

});
it("should be possible to template xml files with expressionParser", function () {
var doc = new TxtTemplater("<t>&gt; {user}</t>", {
parser: expressionParser
});
expect(doc.render({
user: "<zaza> ",
age: 12
})).to.be.equal("<t>&gt; <zaza> </t>");
});
it("should be possible to use loops", function () {

@@ -36,2 +48,22 @@ var doc = new TxtTemplater("Hello {#users}{name},{/users} how are you ?", {

});
it("should throw specific error if loop not closed", function () {
var expectedError = wrapMultiError({
name: "TemplateError",
message: "Unclosed loop",
properties: {
id: "unclosed_loop",
xtag: "users",
offset: 6
}
});
expectToThrow(function () {
return new TxtTemplater("Hello {#users}");
}, Errors.XTTemplateError, expectedError);
});
it("should work with xml-namespace", function () {
var doc = new TxtTemplater('<?xml version="1.0" encoding="UTF-8”?> Hello {name}');
expect(doc.render({
name: "John"
})).to.be.equal('<?xml version="1.0" encoding="UTF-8”?> Hello John');
});
});

@@ -1,1 +0,1 @@

module.exports=["2.png","block-image-inside-inline-loop.docx","columns-of-different-sizes.docx","cover.docx","cover.jpeg","cpf.jpg","d.jpeg","demo_generated.docx","demo_template.docx","doc-with-vfill.docx","double-inside-text.docx","double.docx","expected-100pct-table.docx","expected-base64.docx","expected-buffer.docx","expected-centered-100pct.docx","expected-centered-from-doc.docx","expected-centered.docx","expected-cm-size.docx","expected-columns-of-different-sizes.docx","expected-cover.docx","expected-cpf.docx","expected-doc-with-vfill.docx","expected-dpi-v2.docx","expected-dpi.docx","expected-emu-size.docx","expected-header-footer-100pct.docx","expected-header-footer.docx","expected-image-100pct.docx","expected-image-after-condition.pptx","expected-image-description.docx","expected-image-flipped-horizontal.docx","expected-image-flipped-vertical.docx","expected-image-from-named-image-descr.docx","expected-image-from-named-image-multi-ext.pptx","expected-image-from-named-image-without-size-change.pptx","expected-image-from-named-image.docx","expected-image-from-named-image.pptx","expected-image-from-table.pptx","expected-image-header-with-title.docx","expected-image-in-sectpr-full-width.docx","expected-image-inside-lpstr-app-xml.pptx","expected-image-link-2.docx","expected-image-link.docx","expected-image-link.pptx","expected-image-rotated.docx","expected-image-table-bg-multi-fill.pptx","expected-image-table-fill-no-tcpr.pptx","expected-image-table-fill.pptx","expected-image-table-loop.pptx","expected-image-table-multi-fill.pptx","expected-image-with-alt-text.docx","expected-image-with-null.docx","expected-image-within-loop.pptx","expected-images-inside-cols.docx","expected-inline-caption-height.docx","expected-inline-caption-noprefix.docx","expected-inline-caption-surrounded.docx","expected-inline-caption.docx","expected-inline-image-with-close-text.docx","expected-inline-images.docx","expected-inline-no-caption.docx","expected-inline-resize.docx","expected-inline.docx","expected-inside-textbox.docx","expected-inside-textbox.pptx","expected-instr-text-includepicture.docx","expected-jpeg.docx","expected-kept-original-image.docx","expected-left-aligned.docx","expected-link-with-media.docx","expected-loop-centered.docx","expected-loop-image-caption.docx","expected-loop-null-getter.docx","expected-loop-repeated-images.docx","expected-many-images.docx","expected-multi-footer-section.docx","expected-multi-image-async.docx","expected-multi-image-caption.docx","expected-named-image.docx","expected-no-image.docx","expected-office365.docx","expected-one-image.docx","expected-one-media.docx","expected-png-with-svg-replacement.docx","expected-properties.docx","expected-purl.docx","expected-removed-header-footer.docx","expected-rendered-extlist.pptx","expected-replaced-image-link.docx","expected-resize-center.pptx","expected-resize-flipped.pptx","expected-resize-moved.pptx","expected-resize-rotated.pptx","expected-resize-with-link.pptx","expected-right-aligned.docx","expected-sized-image.docx","expected-slidemaster.pptx","expected-svg-async-with-fallback.docx","expected-svg-async.docx","expected-svg-centered-sync.docx","expected-svg-inline-sync.docx","expected-svg-sync.docx","expected-svg.docx","expected-table.docx","expected-tag-image-centered.pptx","expected-tag-image-rotated.pptx","expected-tag-image-slide-layout.pptx","expected-tag-image.pptx","expected-tag-in-textbox.docx","expected-uncentered-from-negation.docx","expected-vshape-textbox.docx","expected-webp-document.docx","expected-without-rels.docx","image-after-condition.pptx","image-after-loop.docx","image-example-async.docx","image-example-sized.docx","image-example.docx","image-header-footer-example.docx","image-header-with-title.docx","image-in-condition-to-remove.docx","image-in-header-footer-condition-to-remove.docx","image-in-sectpr-full-width.docx","image-in-table.docx","image-inline-example.docx","image-inside-lpstr-app-xml.pptx","image-link.docx","image-loop-example.docx","image-table-fill-no-tcpr.pptx","image-table-fill.pptx","image-table-loop.pptx","image-table-multi-fill.pptx","image-with-alt-text.docx","image-with-column-description.pptx","image-with-null.docx","image-with-slidelayout.pptx","image-within-loop.pptx","image.png","image2.png","images-inside-cols.docx","inline-image-inside-inline-loop.docx","inline-image-with-close-text.docx","inside-textbox.docx","inside-textbox.pptx","instr-text-includepicture.docx","link-with-media.docx","logo.svg","loop-image-caption.docx","loop-with-already-existing-images.docx","money.png","money.webp","multi-footer-section.docx","multi-image.docx","named-image-multi-ext.pptx","named-image.docx","named-image.pptx","office365.docx","png-with-svg-replacement.docx","properties.docx","purl.docx","resize-center.pptx","shape-with-other-text.pptx","slidemaster.pptx","svg_unsupported.png","table-with-placeholder.pptx","tag-image-centered.pptx","tag-image.pptx","tag-in-textbox.docx","tag-with-extlist.pptx","vshape-textbox.docx","within-loop.pptx","without-rels.docx"]
module.exports=["a16-row-id.pdf","a16-row-id.pptx","angular-example.docx","angular-example.pdf","assignment.docx","assignment.pdf","bug-closing-placeholder-orphan.docx","comment-with-loop.docx","comment-with-loop.pdf","cond-image-no-innertext-before.docx","cond-image-no-innertext-before.pdf","cond-image-no-innertext.docx","cond-image-no-innertext.pdf","cond-image.docx","cond-image.pdf","core-xml-missing-close-tag.docx","cyrillic.docx","cyrillic.pdf","delimiter-gt.docx","delimiter-gt.pdf","delimiter-pct.docx","delimiter-pct.pdf","empty-loop-regression.docx","empty-loop-regression.pdf","errors-footer-and-header.docx","errors-footer-and-header.pdf","expected-a16-row-id.pdf","expected-a16-row-id.pptx","expected-assignment.docx","expected-assignment.pdf","expected-bug-closing-placeholder-orphan.docx","expected-comment-example.docx","expected-comment-example.pdf","expected-comments.docx","expected-cond-image-no-innertext-before.docx","expected-cond-image-no-innertext-before.pdf","expected-cond-image-no-innertext.docx","expected-cond-image-no-innertext.pdf","expected-cond-image.docx","expected-cond-image.pdf","expected-core-xml.docx","expected-docm.docm","expected-dotm.dotm","expected-dotx.dotx","expected-empty-table.docx","expected-empty-table.pdf","expected-header-without-digit.docx","expected-header-without-digit.pdf","expected-loop-example.pdf","expected-loop-example.pptx","expected-loop-hebrew.docx","expected-loop-hebrew.pdf","expected-loop-images-footer.docx","expected-loop-images-footer.pdf","expected-loop-images.docx","expected-loop-images.pdf","expected-loop-raw-xml.docx","expected-loop-raw-xml.pdf","expected-loop-regression.docx","expected-loop-regression.pdf","expected-loop-table.pdf","expected-loop-table.pptx","expected-loop-valid.docx","expected-loop-valid.pdf","expected-loop-with-continuous-section-break-2.docx","expected-loop-with-continuous-section-break-2.pdf","expected-loop-with-continuous-section-break.docx","expected-loop-with-continuous-section-break.pdf","expected-loop-with-section-break-after.docx","expected-loop-with-section-break-after.pdf","expected-module-change-rels.docx","expected-module-change-rels.pdf","expected-multi-loop.docx","expected-multi-loop.pdf","expected-multi-section.docx","expected-multi-section.pdf","expected-multiline-indent.docx","expected-multiline-indent.pdf","expected-multiline.docx","expected-multiline.pdf","expected-multiline.pptx","expected-nextpage-section-break.docx","expected-nextpage-section-break.pdf","expected-no-multiline.docx","expected-no-multiline.pdf","expected-no-multiline.pptx","expected-no-proofstate.docx","expected-no-proofstate.pdf","expected-noparagraph-loop-with-pagebreak.docx","expected-noparagraph-loop-with-pagebreak.pdf","expected-office365.docx","expected-office365.pdf","expected-page-break-3-els-std-loop.docx","expected-page-break-3-els-std-loop.pdf","expected-page-break-falsy-std-loop.docx","expected-page-break-falsy-std-loop.pdf","expected-page-break-truthy-std-loop.docx","expected-page-break-truthy-std-loop.pdf","expected-page-section-break.docx","expected-page-section-break.pdf","expected-pagebreak-table-loop.docx","expected-pagebreak-table-loop.pdf","expected-paragraph-loop-empty-with-pagebreak.docx","expected-paragraph-loop-empty-with-pagebreak.pdf","expected-paragraph-loop-with-pagebreak.docx","expected-paragraph-loop-with-pagebreak.pdf","expected-paragraph-loop-with-section-break-after.docx","expected-paragraph-loop-with-section-break-after.pdf","expected-paragraph-loop.docx","expected-paragraph-loop.pdf","expected-paragraph-loop.pptx","expected-pptm.pptm","expected-quotes-in-tag.docx","expected-quotes-in-tag.pdf","expected-raw-xml-after-table.docx","expected-raw-xml-after-table.pdf","expected-raw-xml-example.pdf","expected-raw-xml-example.pptx","expected-raw-xml-null.docx","expected-raw-xml-null.pdf","expected-raw-xml.docx","expected-raw-xml.pdf","expected-regression-complex-loops.docx","expected-regression-complex-loops.pdf","expected-regression-loops-resolve-long.docx","expected-regression-loops-resolve-long.pdf","expected-regression-loops-resolve.docx","expected-regression-loops-resolve.pdf","expected-regression-multiline.pdf","expected-regression-multiline.pptx","expected-rendered-hello.docx","expected-rendered-hello.pdf","expected-rendered-par-in-par.docx","expected-rendered-par-in-par.pdf","expected-run-props-linebreak.pdf","expected-run-props-linebreak.pptx","expected-sdt-content.docx","expected-sdtcontent-valid.docx","expected-sdtcontent-valid.pdf","expected-self-closing-w-sdtcontent.docx","expected-self-closing-w-sdtcontent.pdf","expected-spacing-end.docx","expected-spacing-end.pdf","expected-tab-character.pdf","expected-tab-character.pptx","expected-table-3-cells.pdf","expected-table-3-cells.pptx","expected-table-3-true-cells.pdf","expected-table-3-true-cells.pptx","expected-table-empty.docx","expected-table-empty.pdf","expected-table-example.pdf","expected-table-example.pptx","expected-table-in-table-corruption.docx","expected-table-in-table-corruption.pdf","expected-tag-docprops-in-doc.docx","expected-tag-docprops-in-doc.pdf","expected-tag-docprops.docx","expected-tag-docprops.pdf","expected-tag-example.docx","expected-tag-example.pdf","expected-tag-in-title.pptx","expected-tag-intelligent-loop-table.docx","expected-tag-intelligent-loop-table.pdf","expected-tag-spanning-multiline.docx","expected-tag-with-comment.docx","expected-tag-with-comment.pdf","expected-two-multiline.docx","expected-two-multiline.pdf","expected-users.docx","expected-users.pdf","expected-with-default-contenttype.docx","expected-with-default-contenttype.pdf","expected-with-page-break-3-els.docx","expected-with-page-break-3-els.pdf","expected-with-page-break-falsy-without-paragraph-loop.docx","expected-with-page-break-falsy-without-paragraph-loop.pdf","expected-with-page-break-falsy.docx","expected-with-page-break-falsy.pdf","expected-with-page-break-truthy.docx","expected-with-page-break-truthy.pdf","gt-delimiters.docx","gt-delimiters.pdf","header-without-digit.docx","header-without-digit.pdf","input.docm","input.dotm","input.dotx","input.pptm","loop-example.pdf","loop-example.pptx","loop-hebrew.docx","loop-hebrew.pdf","loop-image-footer.docx","loop-image-footer.pdf","loop-image.docx","loop-image.pdf","loop-table.pdf","loop-table.pptx","loop-valid.docx","loop-valid.pdf","loop-with-continuous-section-break.docx","loop-with-continuous-section-break.pdf","loop-with-page-section-break.docx","loop-with-page-section-break.pdf","loop-with-section-break-after.docx","loop-with-section-break-after.pdf","loop-with-section.docx","loop-with-section.pdf","loops-with-table-raw-xml.docx","loops-with-table-raw-xml.pdf","memory-stress.docx","memory-stress.pdf","multi-errors.docx","multi-errors.pdf","multi-level.docx","multi-level.pdf","multi-loop.docx","multi-loop.pdf","multi-page-to-merge.pdf","multi-page-to-merge.pptx","multi-page.pdf","multi-page.pptx","multi-tags.docx","multi-tags.pdf","nextpage-section-break.docx","nextpage-section-break.pdf","office365.docx","office365.pdf","one-raw-xml-tag.docx","one-raw-xml-tag.pdf","page-break-inside-condition.docx","page-break-inside-condition.pdf","pagebreak-table-loop.docx","pagebreak-table-loop.pdf","paragraph-loop-error.docx","paragraph-loop-error.pdf","paragraph-loop-with-pagebreak.docx","paragraph-loop-with-pagebreak.pdf","paragraph-loop-with-section-break-after.docx","paragraph-loop-with-section-break-after.pdf","paragraph-loop.pdf","paragraph-loop.pptx","paragraph-loops.docx","paragraph-loops.pdf","properties.docx","properties.pdf","quotes-in-tag.docx","quotes-in-tag.pdf","raw-xml-after-table.docx","raw-xml-after-table.pdf","raw-xml-example.pdf","raw-xml-example.pptx","regression-complex-loops.docx","regression-complex-loops.pdf","regression-dash-loop-in-table-cell.pdf","regression-dash-loop-in-table-cell.pptx","regression-loops-resolve.docx","regression-loops-resolve.pdf","regression-par-in-par.docx","regression-par-in-par.pdf","regression-sdtcontent-paragraph.docx","regression-sdtcontent-paragraph.pdf","run-props-linebreak.pdf","run-props-linebreak.pptx","sdt-content.docx","self-closing-w-sdtcontent.docx","self-closing-w-sdtcontent.pdf","simple-example.pdf","simple-example.pptx","simple-zip.zip","spacing-end.docx","spacing-end.pdf","tab-character.pdf","tab-character.pptx","table-complex-example.docx","table-complex-example.pdf","table-complex2-example.docx","table-complex2-example.pdf","table-empty.docx","table-empty.pdf","table-example.pdf","table-example.pptx","table-in-table-corruption.docx","table-in-table-corruption.pdf","table-loop.docx","table-loop.pdf","table-raw-xml.docx","table-raw-xml.pdf","table-repeat.docx","table-repeat.pdf","tag-dash-loop-list.docx","tag-dash-loop-list.pdf","tag-dash-loop-table.docx","tag-dash-loop-table.pdf","tag-dash-loop.docx","tag-dash-loop.pdf","tag-docprops-in-doc.docx","tag-docprops-in-doc.pdf","tag-docprops.docx","tag-docprops.pdf","tag-example.docx","tag-example.pdf","tag-formating.docx","tag-formating.pdf","tag-in-title.pptx","tag-intelligent-loop-table.docx","tag-intelligent-loop-table.pdf","tag-inverted-loop-example.docx","tag-inverted-loop-example.pdf","tag-loop-example.docx","tag-loop-example.pdf","tag-looping.docx","tag-looping.pdf","tag-multiline.docx","tag-multiline.pdf","tag-multiline.pptx","tag-product-loop.docx","tag-product-loop.pdf","tag-spanning-multiline.docx","tag-spanning-multiple-lines.docx","tag-spanning-multiple-lines.pdf","tag-spanning-multiple-lines.pptx","tag-with-comment.docx","tag-with-comment.pdf","test.odt","text-example.docx","text-example.pdf","title-example.pdf","title-example.pptx","users.docx","users.pdf","with-comments.docx","with-default-contenttype.docx","with-default-contenttype.pdf","xml-insertion-example.docx","xml-insertion-example.pdf"]

@@ -5,2 +5,3 @@ "use strict";

var _require = require("./utils.js"),
expect = _require.expect,
setExamplesDirectory = _require.setExamplesDirectory,

@@ -21,16 +22,25 @@ setSnapshotFile = _require.setSnapshotFile,

beforeEach(function () {
this.async = false;
this.name = "";
this.options = {};
this.expectedName = "";
this.data = {};
this.renderV4 = function () {
var _this = this;
var doc = createDocV4(this.name, this.options);
if (this.async) {
return doc.renderAsync(this.data).then(function () {
if (_this.expectedName) {
this.renderV4 = function (_ref) {
var _ref$async = _ref.async,
async = _ref$async === void 0 ? false : _ref$async,
_ref$name = _ref.name,
name = _ref$name === void 0 ? "" : _ref$name,
_ref$options = _ref.options,
options = _ref$options === void 0 ? {} : _ref$options,
_ref$expectedName = _ref.expectedName,
expectedName = _ref$expectedName === void 0 ? "" : _ref$expectedName,
_ref$expectedText = _ref.expectedText,
expectedText = _ref$expectedText === void 0 ? "" : _ref$expectedText,
_ref$data = _ref.data,
data = _ref$data === void 0 ? {} : _ref$data;
var doc = createDocV4(name, options);
if (async) {
return doc.renderAsync(data).then(function () {
if (expectedText) {
expect(doc.getFullText()).to.be.equal(expectedText);
}
if (expectedName) {
shouldBeSame({
doc: doc,
expectedName: _this.expectedName
expectedName: expectedName
});

@@ -41,7 +51,10 @@ }

}
doc.render(this.data);
if (this.expectedName) {
doc.render(data);
if (expectedText) {
expect(doc.getFullText()).to.be.equal(expectedText);
}
if (expectedName) {
shouldBeSame({
doc: doc,
expectedName: this.expectedName
expectedName: expectedName
});

@@ -51,5 +64,41 @@ }

};
this.render = function () {
var doc = createDoc(this.name, this.options);
doc.render(this.data);
this.render = function (_ref2) {
var _ref2$async = _ref2.async,
async = _ref2$async === void 0 ? false : _ref2$async,
_ref2$name = _ref2.name,
name = _ref2$name === void 0 ? "" : _ref2$name,
_ref2$options = _ref2.options,
options = _ref2$options === void 0 ? {} : _ref2$options,
_ref2$expectedName = _ref2.expectedName,
expectedName = _ref2$expectedName === void 0 ? "" : _ref2$expectedName,
_ref2$expectedText = _ref2.expectedText,
expectedText = _ref2$expectedText === void 0 ? "" : _ref2$expectedText,
_ref2$data = _ref2.data,
data = _ref2$data === void 0 ? {} : _ref2$data;
var doc = createDoc(name, options);
if (async) {
doc.compile();
return doc.renderAsync(data).then(function () {
if (expectedText) {
expect(doc.getFullText()).to.be.equal(expectedText);
}
if (expectedName) {
shouldBeSame({
doc: doc,
expectedName: expectedName
});
}
return doc;
});
}
doc.render(data);
if (expectedText) {
expect(doc.getFullText()).to.be.equal(expectedText);
}
if (expectedName) {
shouldBeSame({
doc: doc,
expectedName: expectedName
});
}
return doc;

@@ -56,0 +105,0 @@ };

@@ -126,3 +126,3 @@ "use strict";

function isBinaryFile(file1, file2) {
return file1.name.indexOf(".xml") === -1 && file1.name.indexOf(".rels") === -1 && (file1.options.binary || file2.options.binary);
return file1.name.indexOf(".xml") === -1 && file1.name.indexOf(".vml") === -1 && file1.name.indexOf(".rels") === -1 && (file1.options.binary || file2.options.binary);
}

@@ -320,8 +320,8 @@ function isZip(text) {

function errorVerifier(e, type, expectedError) {
e = cloneDeep(e);
expectedError = cloneDeep(expectedError);
var toShowOnFail = e.stack;
expect(e, "No error has been thrown").not.to.be.equal(null);
var toShowOnFail = e.stack;
expect(e, toShowOnFail).to.be.instanceOf(Error, "error is not a Javascript error");
expect(e, toShowOnFail).to.be.instanceOf(type, "error doesn't have the correct type");
e = cloneDeep(e);
expectedError = cloneDeep(expectedError);
expect(e, toShowOnFail).to.be.an("object");

@@ -356,3 +356,2 @@ expect(e, toShowOnFail).to.have.property("properties");

var err = null;
var capture = captureLogs();
try {

@@ -363,3 +362,2 @@ fn();

}
capture.stop();
if (!type) {

@@ -372,14 +370,10 @@ expect(err).to.satisfy(function (err) {

errorVerifier(err, type, expectedError);
return capture;
}
function expectToThrowAsync(fn, type, expectedError) {
var capture = captureLogs();
return Promise.resolve(null).then(function () {
var r = fn();
return r.then(function () {
capture.stop();
return null;
});
})["catch"](function (error) {
capture.stop();
return error;

@@ -394,3 +388,2 @@ }).then(function (err) {

errorVerifier(err, type, expectedError);
return capture;
});

@@ -400,3 +393,2 @@ }

var err = null;
var capture = captureLogs();
try {

@@ -407,20 +399,14 @@ fn();

}
capture.stop();
expect(errToObject(err)).to.matchSnapshot(update);
return capture;
}
function expectToThrowAsyncSnapshot(fn, update) {
var capture = captureLogs();
return Promise.resolve(null).then(function () {
var r = fn();
return r.then(function () {
capture.stop();
return null;
});
})["catch"](function (error) {
capture.stop();
return error;
}).then(function (err) {
expect(errToObject(err)).to.matchSnapshot(update);
return capture;
});

@@ -427,0 +413,0 @@ }

@@ -9,2 +9,4 @@ "use strict";

var defaults = DocUtils.defaults;
var _require = require("./errors.js"),
throwMultiError = _require.throwMultiError;
var renderModule = require("./modules/render.js");

@@ -20,2 +22,3 @@ var loopModule = require("./modules/loop.js");

});
xmlt.fileType = "text";
xmlt.fileTypeConfig = options.fileTypeConfig = {

@@ -34,2 +37,3 @@ droppedTagsInsidePlaceholder: [],

fileTypeConfig: xmlt.fileTypeConfig,
parser: xmlt.parser,
options: xmlt

@@ -59,3 +63,3 @@ });

});
var _Lexer$parse = Lexer.parse(xmlt.xmllexed, xmlt.delimiters, xmlt.syntax),
var _Lexer$parse = Lexer.parse(xmlt),
lexed = _Lexer$parse.lexed,

@@ -73,2 +77,5 @@ lexerErrors = _Lexer$parse.errors;

xmlt.parse();
if (xmlt.allErrors.length > 0) {
throwMultiError(xmlt.allErrors);
}
this.render = function (tags) {

@@ -75,0 +82,0 @@ xmlt.scopeManager = createScope({

@@ -17,4 +17,4 @@ "use strict";

function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("./doc-utils.js"),

@@ -21,0 +21,0 @@ getRightOrNull = _require.getRightOrNull,

@@ -7,4 +7,4 @@ "use strict";

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var _require = require("./doc-utils.js"),

@@ -118,3 +118,3 @@ wordToUtf8 = _require.wordToUtf8,

});
var _Lexer$parse = Lexer.parse(this.xmllexed, this.delimiters, this.syntax),
var _Lexer$parse = Lexer.parse(this),
lexed = _Lexer$parse.lexed,

@@ -121,0 +121,0 @@ lexerErrors = _Lexer$parse.errors;

{
"name": "docxtemplater",
"version": "3.42.4",
"version": "3.42.5",
"author": "Edgar Hipp",

@@ -43,8 +43,8 @@ "description": "Generate docx, pptx, and xlsx from templates (Word, Powerpoint and Excel documents), from Node.js, the Browser and the command line",

"@babel/cli": "^7.23.4",
"@babel/core": "^7.23.5",
"@babel/core": "^7.23.6",
"@babel/eslint-parser": "^7.23.3",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/preset-env": "^7.23.5",
"@stryker-mutator/core": "^7.3.0",
"@stryker-mutator/mocha-runner": "^7.3.0",
"@babel/preset-env": "^7.23.6",
"@stryker-mutator/core": "^8.0.0",
"@stryker-mutator/mocha-runner": "^8.0.0",
"@wdio/cli": "8.12.2",

@@ -61,3 +61,3 @@ "angular-expressions": "^1.1.9",

"eslint_d": "^13.1.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-sort-class-members": "^1.18.0",

@@ -71,5 +71,5 @@ "eslint-plugin-specific-sort": "file:.eslint-rules",

"pizzip": "^3.1.4",
"prettier": "^3.1.0",
"prettier": "^3.1.1",
"rimraf": "^5.0.5",
"selenium-standalone": "^9.3.0",
"selenium-standalone": "^9.3.1",
"serve-static": "^1.15.0",

@@ -76,0 +76,0 @@ "stryker-cli": "^1.0.2",

@@ -9,2 +9,4 @@ "use strict";

var defaults = DocUtils.defaults;
var _require = require("./js/errors.js"),
throwMultiError = _require.throwMultiError;
var renderModule = require("./js/modules/render.js");

@@ -20,2 +22,3 @@ var loopModule = require("./js/modules/loop.js");

});
xmlt.fileType = "text";
xmlt.fileTypeConfig = options.fileTypeConfig = {

@@ -34,2 +37,3 @@ droppedTagsInsidePlaceholder: [],

fileTypeConfig: xmlt.fileTypeConfig,
parser: xmlt.parser,
options: xmlt

@@ -59,3 +63,3 @@ });

});
var _Lexer$parse = Lexer.parse(xmlt.xmllexed, xmlt.delimiters, xmlt.syntax),
var _Lexer$parse = Lexer.parse(xmlt),
lexed = _Lexer$parse.lexed,

@@ -73,2 +77,5 @@ lexerErrors = _Lexer$parse.errors;

xmlt.parse();
if (xmlt.allErrors.length > 0) {
throwMultiError(xmlt.allErrors);
}
this.render = function (tags) {

@@ -75,0 +82,0 @@ xmlt.scopeManager = createScope({

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc