diff --git a/public/src/templates.js b/public/src/templates.js index e34ac77588..368c80a277 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -76,7 +76,7 @@ } function makeRegex(block) { - return new RegExp("[\\s\\S]*", 'g'); + return new RegExp("[\\s\\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][\s|\S]/), - match = matches[i].replace(statement, '').replace(/[\s|\S][\s|\S]/, ''), + match = matches[i].replace(statement, '').replace(/[\s|\S][\s|\S]/gi, ''), conditionalBlock = match.split(/\s*\s*/); if (conditionalBlock[1]) { @@ -124,7 +124,9 @@ } if (nestedConditionals) { - template = template.replace('', nestedConditionals[0]); + for (var x = 0, xx = nestedConditionals.length; x < xx; x++) { + template = template.replace('', nestedConditionals[x]); + } } } }