Fix crash with wrong template

+ add log filter for use in templates
parent 28e10654
......@@ -36,7 +36,11 @@ env.addFilter('paginationList', function(page, count) {
});
env.addFilter('inspect', function(obj) {
return util.inspect(obj);
return util.inspect(obj);
});
env.addFilter('log', function(obj) {
return console.log(obj);
});
env.addFilter('relURL', function(filename, dir){
......@@ -53,6 +57,13 @@ module.exports = function(data, type) {
resolve(tmpl);
});
}).then(function(tmpl) {
return tmpl.render(data);
return new Promise(function(resolve, reject){
tmpl.render(data, function(err, val) {
if(err) {
reject(err);
}
resolve(val);
});
})
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment