imported latest templates.js

v1.18.x
psychobunny 11 years ago
parent 0a35195fc7
commit 81dfbba0ec

@ -76,7 +76,7 @@
}
function makeRegex(block) {
return new RegExp("<!--[\\s]*BEGIN " + block + "[\\s]*-->[\\s\\S]*<!--[\\s]*END " + block + "[\\s]*-->", 'g');
return new RegExp("<!--[\\s]*BEGIN " + block + "[\\s]*-->[\\s\\S]*?<!--[\\s]*END " + block + "[\\s]*-->", 'g');
}
function makeConditionalRegex(block) {
@ -104,7 +104,7 @@
for (var i = 0, ii = matches.length; i < ii; i++) {
var statement = makeStatementRegex(key),
nestedConditionals = matches[i].match(/[\s|\S]<!-- IF[\s\S]*ENDIF[\s\S]*-->[\s|\S]/),
match = matches[i].replace(statement, '').replace(/[\s|\S]<!-- IF[\s\S]*ENDIF[\s\S]*-->[\s|\S]/, '<!-- NESTED -->'),
match = matches[i].replace(statement, '').replace(/[\s|\S]<!-- IF[\s\S]*ENDIF[\s\S]*-->[\s|\S]/gi, '<!-- NESTED -->'),
conditionalBlock = match.split(/\s*<!-- ELSE -->\s*/);
if (conditionalBlock[1]) {
@ -124,7 +124,9 @@
}
if (nestedConditionals) {
template = template.replace('<!-- NESTED -->', nestedConditionals[0]);
for (var x = 0, xx = nestedConditionals.length; x < xx; x++) {
template = template.replace('<!-- NESTED -->', nestedConditionals[x]);
}
}
}
}

Loading…
Cancel
Save