mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
closes #917
This commit is contained in:
@@ -331,19 +331,21 @@
|
||||
for (var i = 0, ii = matches.length; i < ii; i++) {
|
||||
var conditionalBlock = matches[i].split(/<!-- ELSE -->/);
|
||||
|
||||
var statement = new RegExp("(<!--[\\s]*IF " + key + "[\\s]*-->)|(<!--[\\s]*ENDIF " + key + "[\\s]*-->)", 'gi');
|
||||
|
||||
if (conditionalBlock[1]) {
|
||||
// there is an else statement
|
||||
if (!value) {
|
||||
template = template.replace(matches[i], conditionalBlock[1].replace(/<!-- ((\IF\b)|(\bENDIF\b))([^@]*?)-->/gi, ''));
|
||||
template = template.replace(matches[i], conditionalBlock[1].replace(statement, ''));
|
||||
} else {
|
||||
template = template.replace(matches[i], conditionalBlock[0].replace(/<!-- ((\IF\b)|(\bENDIF\b))([^@]*?)-->/gi, ''));
|
||||
template = template.replace(matches[i], conditionalBlock[0].replace(statement, ''));
|
||||
}
|
||||
} else {
|
||||
// regular if statement
|
||||
if (!value) {
|
||||
template = template.replace(matches[i], '');
|
||||
} else {
|
||||
template = template.replace(matches[i], matches[i].replace(/<!-- ((\IF\b)|(\bENDIF\b))([^@]*?)-->/gi, ''));
|
||||
template = template.replace(matches[i], matches[i].replace(statement, ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user