mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
updated latest templates.js
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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]) {
|
||||
|
||||
Reference in New Issue
Block a user