diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-10-14 12:31:37 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-10-14 12:31:37 +0200 |
commit | ee8ccc6d7ed4e85e485f010350b5a5e37b9a00c4 (patch) | |
tree | 32c48cd41e1738c9ede0ebe46b9b06a24cc80338 /lib/configuration.js | |
parent | 8ee0bcac2a9df0a5a46f354b5bd9d5c32d4dcaa4 (diff) | |
download | gitbook-ee8ccc6d7ed4e85e485f010350b5a5e37b9a00c4.zip gitbook-ee8ccc6d7ed4e85e485f010350b5a5e37b9a00c4.tar.gz gitbook-ee8ccc6d7ed4e85e485f010350b5a5e37b9a00c4.tar.bz2 |
Fix legacy properties book.options.input, ...
Diffstat (limited to 'lib/configuration.js')
-rw-r--r-- | lib/configuration.js | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/configuration.js b/lib/configuration.js index 5c5f9af..86478c8 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -84,31 +84,8 @@ function normalizePluginsList(plugins, addDefaults) { } var Configuration = function(book, options) { - var that = this; - this.book = book; this.replace(options); - - // options.input == book.root - Object.defineProperty(this.options, 'input', { - get: function () { - return that.book.root; - } - }); - - // options.originalInput == book.parent.root - Object.defineProperty(this.options, 'originalInput', { - get: function () { - return that.book.parent? that.book.parent.root : undefined; - } - }); - - // options.originalOutput == book.parent.options.output - Object.defineProperty(this.options, 'originalOutput', { - get: function () { - return that.book.parent? that.book.parent.options.output : undefined; - } - }); }; // Read and parse the configuration @@ -171,8 +148,31 @@ Configuration.prototype.extend = function(options) { // Replace the whole configuration Configuration.prototype.replace = function(options) { + var that = this; + this.options = _.cloneDeep(DEFAULT_CONFIG); this.options = _.merge(this.options, options || {}); + + // options.input == book.root + Object.defineProperty(this.options, 'input', { + get: function () { + return that.book.root; + } + }); + + // options.originalInput == book.parent.root + Object.defineProperty(this.options, 'originalInput', { + get: function () { + return that.book.parent? that.book.parent.root : undefined; + } + }); + + // options.originalOutput == book.parent.options.output + Object.defineProperty(this.options, 'originalOutput', { + get: function () { + return that.book.parent? that.book.parent.options.output : undefined; + } + }); }; // Dump configuration as json object |