mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-24 03:16:40 +00:00
Fix context for template block/filters
This commit is contained in:
+11
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user