v1.18.x
psychobunny 11 years ago
parent d1eba104d2
commit ecc1c315cc

@ -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;

Loading…
Cancel
Save