diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-03-09 15:50:38 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-03-09 15:50:38 +0100 |
commit | c499a8a13a3059e3953727866beb7c986e46dd78 (patch) | |
tree | 173ee93cb957446855d8519335ad5dba0f7cc332 /lib/output/base.js | |
parent | 64a6de751d0f2bd8910ce36e2e8aa4049316e2c7 (diff) | |
download | gitbook-c499a8a13a3059e3953727866beb7c986e46dd78.zip gitbook-c499a8a13a3059e3953727866beb7c986e46dd78.tar.gz gitbook-c499a8a13a3059e3953727866beb7c986e46dd78.tar.bz2 |
Add back gitbook.generator property as deprecated
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 |