Skip to content

Commit

Permalink
Avoid running expandToOne multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
edi9999 committed Aug 30, 2022
1 parent 26fd4a4 commit 3fe10a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 3.31.4

Bugfix for table module : merge-cells-col did not work correctly when placed inside a loop.

Fixes : https://github.com/open-xml-templating/docxtemplater/issues/671

### 3.31.3

Bugfix to avoid throwing following error :
Expand Down
8 changes: 7 additions & 1 deletion es6/traits.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,13 @@ function expandToOne(postparsed, options) {
const limits = [];
for (let i = 0, len = postparsed.length; i < len; i++) {
const part = postparsed[i];
if (part.type === "placeholder" && part.module === options.moduleName) {
if (
part.type === "placeholder" &&
part.module === options.moduleName &&
// The part.subparsed check is used to fix this github issue :
// https://github.com/open-xml-templating/docxtemplater/issues/671
!part.subparsed
) {
try {
const limit = getExpandLimit(part, i, postparsed, options);
if (!limit) {
Expand Down

0 comments on commit 3fe10a6

Please sign in to comment.