diff --git a/public/src/templates.js b/public/src/templates.js index 05d7a82fe6..d9872cb0ed 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -331,19 +331,21 @@ for (var i = 0, ii = matches.length; i < ii; i++) { var conditionalBlock = matches[i].split(//); + var statement = new RegExp("()|()", 'gi'); + if (conditionalBlock[1]) { // there is an else statement if (!value) { - template = template.replace(matches[i], conditionalBlock[1].replace(//gi, '')); + template = template.replace(matches[i], conditionalBlock[1].replace(statement, '')); } else { - template = template.replace(matches[i], conditionalBlock[0].replace(//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(//gi, '')); + template = template.replace(matches[i], matches[i].replace(statement, '')); } } }