mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 11:11:04 +01:00
fixes #123, parse object properties in template outside of namespace
This commit is contained in:
@@ -300,14 +300,7 @@
|
|||||||
namespace = namespace.replace(d + '.', '');
|
namespace = namespace.replace(d + '.', '');
|
||||||
template = setBlock(regex, result, template);
|
template = setBlock(regex, result, template);
|
||||||
} else if (data[d] instanceof Object) {
|
} else if (data[d] instanceof Object) {
|
||||||
namespace += d + '.';
|
template = parse(data[d], d + '.', template);
|
||||||
|
|
||||||
regex = makeRegex(d),
|
|
||||||
block = getBlock(regex, namespace, template)
|
|
||||||
if (block == null) continue;
|
|
||||||
|
|
||||||
block = parse(data[d], namespace, block);
|
|
||||||
template = setBlock(regex, block, template);
|
|
||||||
} else {
|
} else {
|
||||||
function checkConditional(key, value) {
|
function checkConditional(key, value) {
|
||||||
var conditional = makeConditionalRegex(key),
|
var conditional = makeConditionalRegex(key),
|
||||||
@@ -352,6 +345,7 @@
|
|||||||
if (namespace) {
|
if (namespace) {
|
||||||
var regex = new RegExp("{" + namespace + "[\\s\\S]*?}", 'g');
|
var regex = new RegExp("{" + namespace + "[\\s\\S]*?}", 'g');
|
||||||
template = template.replace(regex, '');
|
template = template.replace(regex, '');
|
||||||
|
namespace = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up all undefined conditionals
|
// clean up all undefined conditionals
|
||||||
|
|||||||
Reference in New Issue
Block a user