mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
closes #927
This commit is contained in:
@@ -385,8 +385,14 @@
|
||||
} else if (data[d] instanceof Object) {
|
||||
template = parse(data[d], d + '.', template);
|
||||
} else {
|
||||
checkConditional(namespace + d, data[d]);
|
||||
checkConditional('!' + namespace + d, !data[d]);
|
||||
var key = namespace + d,
|
||||
value = typeof data[d] === 'string' ? data[d].replace(/^\s+|\s+$/g, '') : data[d];
|
||||
|
||||
if (key === 'metaTags.content' && data[d]) {
|
||||
console.log(typeof data[d] === 'string', data[d].replace(/^\s+|\s+$/g, ''));
|
||||
}
|
||||
checkConditional(key, value);
|
||||
checkConditional('!' + key, !value);
|
||||
|
||||
if (blockInfo && blockInfo.iterator) {
|
||||
checkConditional('@first', blockInfo.iterator === 0);
|
||||
@@ -395,7 +401,7 @@
|
||||
checkConditional('!@last', blockInfo.iterator !== blockInfo.total);
|
||||
}
|
||||
|
||||
template = replace(namespace + d, data[d], template);
|
||||
template = replace(key, value, template);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -406,7 +412,8 @@
|
||||
namespace = '';
|
||||
} else {
|
||||
// clean up all undefined conditionals
|
||||
template = template.replace(/(<!-- IF([^@]*?)(ELSE -->| -->))|(<!-- ENDIF([^@]*?)-->)/gi, '');
|
||||
template = template.replace(/<!-- ELSE -->/gi, 'ENDIF -->')
|
||||
.replace(/<!-- IF([^@]*?)ENDIF([^@]*?)-->/gi, '');
|
||||
}
|
||||
|
||||
return template;
|
||||
|
||||
Reference in New Issue
Block a user