Comparing version 1.0.22 to 1.0.23
@@ -10,3 +10,2 @@ declare const _exports: Sjablong; | ||
brackets: RegExp; | ||
full: RegExp; | ||
keyvalue: RegExp; | ||
@@ -13,0 +12,0 @@ }; |
@@ -33,4 +33,3 @@ /* | ||
brackets: /(\[\[[^\]]*\]\])/gm, | ||
full: /\[\[(\s*?.*?\s*?)*?\]\]/gm, | ||
keyvalue: /[a-zA-Z]+?\w*?="[^]*?"/gm | ||
keyvalue: /[a-zA-Z]+?\w*?=".*?"/gm | ||
}, | ||
@@ -104,3 +103,3 @@ mustache: { | ||
// Check that there are placeholders | ||
const placeholders = text.match(this.regexPatterns.sjablong.full); | ||
const placeholders = text.match(this.regexPatterns.sjablong.brackets); | ||
if (!placeholders || (Array.isArray(placeholders) && placeholders.length === 0)) { return []; } | ||
@@ -131,3 +130,3 @@ | ||
// Get all placeholders | ||
const placeholders = text.match(this.regexPatterns.sjablong.full); | ||
const placeholders = text.match(this.regexPatterns.sjablong.brackets); | ||
@@ -134,0 +133,0 @@ // Replace all the VTFK placeholders |
{ | ||
"name": "sjablong", | ||
"version": "1.0.22", | ||
"version": "1.0.23", | ||
"description": "A system for replacing and/or validating replacement-fields in text", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,2 +7,3 @@ /* | ||
const Sjablong = require('../lib/sjablong'); | ||
const { inspect } = require('../lib/vtfk-utilities/vtfk-utilities'); | ||
@@ -92,5 +93,6 @@ /* | ||
const placeholders = Sjablong.getPlaceholders(template); | ||
inspect(placeholders); | ||
test('Is not undefined', () => expect(placeholders).not.toBeUndefined()); | ||
test('Has 4 placeholders', () => expect(placeholders.length).toBe(4)); | ||
test('Item 2 has multiline default value', () => expect(placeholders[1].default.includes('\n')).toBeTruthy()); | ||
test('Item 2 has multiline default value', () => expect(placeholders[1].default.includes('\\n')).toBeTruthy()); | ||
}) | ||
@@ -97,0 +99,0 @@ |
@@ -6,5 +6,3 @@ ##Test placeholders## | ||
**Without sepparators and multiline default** | ||
[[label="Test2"default="Line1 | ||
Line2 | ||
Line3" | ||
[[label="Test2"default="Line1\nLine2\nLine3" | ||
path="a.b.test2" | ||
@@ -11,0 +9,0 @@ ]] |
39556