New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

docx-templates

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docx-templates - npm Package Compare versions

Comparing version 4.11.5 to 4.12.0

3

CHANGELOG.md

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

## 4.12.0 (2024-04-01)
- [#15](https://github.com/guigrpa/docx-templates/issues/15) Generate columns for a table using `FOR` loop.
## 4.11.5 (2024-03-24)

@@ -2,0 +5,0 @@ - [#340](https://github.com/guigrpa/docx-templates/issues/340) Fix for infinite loop bug: don't allow nested IFs on same `w:p` or `w:tr` tag.

@@ -146,2 +146,3 @@ type Buffer = ArrayBufferLike;

'w:tr': BufferStatus;
'w:tc': BufferStatus;
};

@@ -148,0 +149,0 @@ pendingImageNode?: {

15

lib/processTemplate.js

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

'w:tr': { text: '', cmds: '', fInsertedText: false },
'w:tc': { text: '', cmds: '', fInsertedText: false },
},

@@ -280,3 +281,6 @@ imageAndShapeIdIncrement: imageAndShapeIdIncrement,

// Delete last generated output node if we're skipping nodes due to an empty FOR loop
if ((tag === 'w:p' || tag === 'w:tbl' || tag === 'w:tr') &&
if ((tag === 'w:p' ||
tag === 'w:tbl' ||
tag === 'w:tr' ||
tag === 'w:tc') &&
(0, reportUtils_1.isLoopExploring)(ctx)) {

@@ -287,3 +291,3 @@ fRemoveNode = true;

}
else if (tag === 'w:p' || tag === 'w:tr') {
else if (tag === 'w:p' || tag === 'w:tr' || tag === 'w:tc') {
buffers = ctx.buffers[tag];

@@ -333,2 +337,3 @@ fRemoveNode =

ctx.buffers['w:tr'].fInsertedText = true;
ctx.buffers['w:tc'].fInsertedText = true;
}

@@ -351,2 +356,3 @@ delete ctx.pendingImageNode;

ctx.buffers['w:tr'].fInsertedText = true;
ctx.buffers['w:tc'].fInsertedText = true;
}

@@ -369,2 +375,3 @@ delete ctx.pendingLinkNode;

ctx.buffers['w:tr'].fInsertedText = true;
ctx.buffers['w:tc'].fInsertedText = true;
}

@@ -402,3 +409,3 @@ delete ctx.pendingHtmlNode;

tag = nodeIn._fTextNode ? null : nodeIn._tag;
if (tag === 'w:p' || tag === 'w:tr') {
if (tag === 'w:p' || tag === 'w:tr' || tag === 'w:tc') {
ctx.buffers[tag] = { text: '', cmds: '', fInsertedText: false };

@@ -1033,3 +1040,3 @@ }

// ==========================================
var BufferKeys = ['w:p', 'w:tr'];
var BufferKeys = ['w:p', 'w:tr', 'w:tc'];
var appendTextToTagBuffers = function (text, ctx, options) {

@@ -1036,0 +1043,0 @@ if (ctx.fSeekQuery)

@@ -135,2 +135,3 @@ import { QualifiedAttribute } from 'sax';

'w:tr': BufferStatus;
'w:tc': BufferStatus;
};

@@ -137,0 +138,0 @@ pendingImageNode?: {

{
"name": "docx-templates",
"version": "4.11.5",
"version": "4.12.0",
"description": "Template-based docx report creation",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -497,2 +497,18 @@ # Docx-templates [![Coverage Status](https://coveralls.io/repos/github/guigrpa/docx-templates/badge.svg?branch=master)](https://coveralls.io/github/guigrpa/docx-templates?branch=master) [![npm version](https://img.shields.io/npm/v/docx-templates.svg)](https://www.npmjs.com/package/docx-templates)

And let you dynamically generate columns:
```
+-------------------------------+--------------------+------------------------+
| +++ FOR row IN rows+++ | | |
+===============================+====================+========================+
| +++ FOR column IN columns +++ | +++INS $row+++ | +++ END-FOR column +++ |
| | | |
| | Some cell content | |
| | | |
| | +++INS $column+++ | |
+-------------------------------+--------------------+------------------------+
| +++ END-FOR row+++ | | |
+-------------------------------+--------------------+------------------------+
```
Finally, you can nest loops (this example assumes a different data set):

@@ -499,0 +515,0 @@

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

Sorry, the diff of this file is not supported yet

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