handle spaces in {tag} placeholders when rendering - closes #148

pull/150/head
robinmoisson 2022-11-30 09:04:47 +01:00
rodzic 158668677d
commit 4fa627980c
3 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -7,7 +7,7 @@
* @returns string * @returns string
*/ */
function renderTemplate(templateString, data) { function renderTemplate(templateString, data) {
return templateString.replace(/{(.*?)}/g, function (_, key) { return templateString.replace(/{\s*(\w+)\s*}/g, function (_, key) {
if (data && data[key] !== undefined) { if (data && data[key] !== undefined) {
return data[key]; return data[key];
} }

4
package-lock.json wygenerowano
Wyświetl plik

@ -1,12 +1,12 @@
{ {
"name": "staticrypt", "name": "staticrypt",
"version": "2.3.3", "version": "2.3.4",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "staticrypt", "name": "staticrypt",
"version": "2.3.3", "version": "2.3.4",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"crypto-js": "3.1.9-1", "crypto-js": "3.1.9-1",

Wyświetl plik

@ -1,6 +1,6 @@
{ {
"name": "staticrypt", "name": "staticrypt",
"version": "2.3.3", "version": "2.3.4",
"description": "Based on the [crypto-js](https://github.com/brix/crypto-js) library, StatiCrypt uses AES-256 to encrypt your input with your passphrase and put it in a HTML file with a password prompt that can decrypted in-browser (client side).", "description": "Based on the [crypto-js](https://github.com/brix/crypto-js) library, StatiCrypt uses AES-256 to encrypt your input with your passphrase and put it in a HTML file with a password prompt that can decrypted in-browser (client side).",
"main": "index.js", "main": "index.js",
"files": [ "files": [