easy-template-x
Advanced tools
Comparing version 0.10.1 to 0.10.2
# Change Log | ||
## [0.10.2 - 2020-02-16](https://github.com/alonrbar/easy-template-x/tree/v0.10.2) | ||
### Fixed | ||
- Parsing of tags with custom delimiters. | ||
## [0.10.1 - 2020-02-12](https://github.com/alonrbar/easy-template-x/tree/v0.10.1) | ||
@@ -4,0 +10,0 @@ |
@@ -5,3 +5,4 @@ export * from './array'; | ||
export * from './path'; | ||
export * from './regex'; | ||
export * from './sha1'; | ||
export * from './types'; |
{ | ||
"name": "easy-template-x", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "Generate docx documents from templates, in Node or in the browser.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import { Delimiters } from '../delimiters'; | ||
import { MissingArgumentError, MissingCloseDelimiterError, MissingStartDelimiterError } from '../errors'; | ||
import { DocxParser } from '../office'; | ||
import { Regex } from '../utils'; | ||
import { DelimiterMark } from './delimiterMark'; | ||
@@ -20,4 +21,3 @@ import { Tag, TagDisposition } from './tag'; | ||
// TODO: regex escape | ||
this.tagRegex = new RegExp(`^[${delimiters.tagStart}](.*?)[${delimiters.tagEnd}]`, 'mi'); | ||
this.tagRegex = new RegExp(`^${Regex.escape(delimiters.tagStart)}(.*?)${Regex.escape(delimiters.tagEnd)}`, 'm'); | ||
} | ||
@@ -72,6 +72,6 @@ | ||
* Consolidate all tag's text into a single text node. | ||
* | ||
* Example: | ||
* | ||
* Text node before: "some text {some tag} some more text" | ||
* | ||
* Example: | ||
* | ||
* Text node before: "some text {some tag} some more text" | ||
* Text nodes after: [ "some text ", "{some tag}", " some more text" ] | ||
@@ -100,3 +100,3 @@ */ | ||
if (closeDelimiter.index < endTextNode.textContent.length - 1) { | ||
endTextNode = this.docParser.splitTextNode(endTextNode, closeDelimiter.index + 1, true); | ||
endTextNode = this.docParser.splitTextNode(endTextNode, closeDelimiter.index + this.delimiters.tagEnd.length, true); | ||
if (sameNode) { | ||
@@ -161,2 +161,2 @@ startTextNode = endTextNode; | ||
} | ||
} | ||
} |
@@ -5,3 +5,4 @@ export * from './array'; | ||
export * from './path'; | ||
export * from './regex'; | ||
export * from './sha1'; | ||
export * from './types'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
344395
144
8114