Skip to content

Node.js based forum software built for the modern web

updated latest templates.js

psychobunny91e29d7bb21e
diff --git a/package.json b/package.json
index ad5ae44b90..01592c9035 100644
--- a/package.json
+++ b/package.json
@@ -58,7 +58,7 @@
"validator": "~3.16.1",
"winston": "~0.7.2",
"xregexp": "~2.0.0",
- "templates.js": "0.0.10"
+ "templates.js": "0.0.13"
},
"devDependencies": {
"mocha": "~1.13.0"
diff --git a/public/src/templates.js b/public/src/templates.js
index fc81b14e29..b629b03d0b 100644
--- a/public/src/templates.js
+++ b/public/src/templates.js
@@ -95,7 +95,7 @@ Please use the npm module instead - require('templates.js')
}
function makeStatementRegex(key) {
- return new RegExp('([\\s]*<!--[\\s]*IF ' + key + '[\\s]*-->)|(<!--[\\s]*ENDIF ' + key + '[\\s]*-->[\\s]*)', 'g');
+ return new RegExp('(<!--[\\s]*IF ' + key + '[\\s]*-->)|(<!--[\\s]*ENDIF ' + key + '[\\s]*-->)', 'g');
}
function registerGlobals(obj) {
@@ -114,8 +114,8 @@ Please use the npm module instead - require('templates.js')
if (matches !== null) {
for (var i = 0, ii = matches.length; i < ii; i++) {
var statement = makeStatementRegex(key),
- nestedConditionals = matches[i].match(/(?!^)<!-- IF[\s\S]*ENDIF[\s\S]*?-->(?!$)/),
- match = matches[i].replace(statement, '').replace(/(?!^)<!-- IF[\s\S]*ENDIF[\s\S]*?-->/gi, '<!-- NESTED -->'),
+ nestedConditionals = matches[i].match(/(?!^)<!-- IF([\s\S]*?)ENDIF[ a-zA-Z0-9\._:]*-->(?!$)/gi),
+ match = matches[i].replace(statement, '').replace(/(?!^)<!-- IF([\s\S]*?)ENDIF[ a-zA-Z0-9\._:]*-->(?!$)/gi, '<!-- NESTED -->'),
conditionalBlock = match.split(/[\r\n?\n]*?<!-- ELSE -->[\r\n?\n]*?/);
if (conditionalBlock[1]) {