diff options
Diffstat (limited to 'lib/output/base.js')
-rw-r--r-- | lib/output/base.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/output/base.js b/lib/output/base.js index 201eade..d513d71 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -5,8 +5,10 @@ var path = require('path'); var Promise = require('../utils/promise'); var pathUtil = require('../utils/path'); var location = require('../utils/location'); +var error = require('../utils/error'); var PluginsManager = require('../plugins'); var TemplateEngine = require('../template'); +var gitbook = require('../gitbook'); /* Output is like a stream interface for a parsed book @@ -37,6 +39,9 @@ function Output(book, opts, parent) { this.ignore = Ignore(); } +// Default name for generator +Output.prototype.name = 'base'; + // Default extension for output Output.prototype.defaultExtension = '.html'; @@ -230,7 +235,7 @@ Output.prototype.getSelfContext = function() { // Return a default context for templates Output.prototype.getContext = function() { - return _.extend( + var ctx = _.extend( { output: this.getSelfContext() }, @@ -238,8 +243,14 @@ Output.prototype.getContext = function() { this.book.langs.getContext(), this.book.summary.getContext(), this.book.glossary.getContext(), - this.book.config.getContext() + this.book.config.getContext(), + gitbook.getContext() ); + + // Deprecated fields + error.deprecateField(ctx.gitbook, 'generator', this.name, '"gitbook.generator" property is deprecated, use "output.name" instead'); + + return ctx; }; // Resolve a file path in the context of a specific page |