diff options
Diffstat (limited to 'lib/template/index.js')
-rw-r--r-- | lib/template/index.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/template/index.js b/lib/template/index.js index 410c2f5..9a5d92f 100644 --- a/lib/template/index.js +++ b/lib/template/index.js @@ -63,6 +63,13 @@ function TemplateEngine(output) { // Add default blocks and filters this.addBlocks(defaultBlocks); this.addFilters(defaultFilters); + + // Build context for this book with depreacted fields + this.ctx = { + book: this.book, + output: this.output + }; + error.deprecateField(this.ctx, 'generator', this.output.name, '"generator" property is deprecated, use "output.generator" instead'); } // Bind a function to a context @@ -71,12 +78,9 @@ TemplateEngine.prototype.bindContext = function(func) { var that = this; 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'); + var ctx = _.extend({ + ctx: this.ctx + }, that.ctx); return func.apply(ctx, arguments); }; |