summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/template/index.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/template/index.js b/lib/template/index.js
index 5af2089..7be16b9 100644
--- a/lib/template/index.js
+++ b/lib/template/index.js
@@ -68,14 +68,18 @@ function TemplateEngine(output) {
// Bind a function to a context
// Filters and blocks are binded to this context
TemplateEngine.prototype.bindContext = function(func) {
- var ctx = {
- ctx: this.ctx,
- book: this.book,
- output: this.output
- };
- error.deprecateField(ctx, 'generator', this.output.name, '"generator" property is deprecated, use "output.generator" instead');
+ var that = this;
- return _.bind(func, ctx);
+ return function() {
+ var ctx = {
+ ctx: this.ctx,
+ book: that.book,
+ output: that.output
+ };
+ error.deprecateField(ctx, 'generator', that.output.name, '"generator" property is deprecated, use "output.generator" instead');
+
+ return func.apply(ctx, arguments);
+ };
};
// Interpolate a string content to replace shortcuts according to the filetype