diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/output/base.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/output/base.js b/lib/output/base.js index fb0adca..e0b58b4 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -15,8 +15,9 @@ to output "something". The process is mostly on the behavior of "onPage" and "onAsset" */ -function Output(book, opts) { +function Output(book, opts, parent) { _.bindAll(this); + this.parent = parent; this.opts = _.defaults(opts || {}, { directoryIndex: true @@ -26,7 +27,11 @@ function Output(book, opts) { this.log = this.book.log; // Create plugins manager - this.plugins = new PluginsManager(this.book); + if (this.parent) { + this.plugins = this.parent.plugins; + } else { + this.plugins = new PluginsManager(this.book); + } // Create template engine this.template = new TemplateEngine(this); @@ -47,7 +52,7 @@ Output.prototype.generate = function() { // Load all plugins .then(function() { - return that.plugins.loadAll() + return Promise(that.parent? null: that.plugins.loadAll()) .then(function() { that.template.addFilters(that.plugins.getFilters()); that.template.addBlocks(that.plugins.getBlocks()); @@ -191,7 +196,7 @@ Output.prototype.onResolveTemplate = function(from, to) { // Prepare output for a language book Output.prototype.onLanguageBook = function(book) { - return new this.constructor(book, this.opts); + return new this.constructor(book, this.opts, this); }; |