diff options
Diffstat (limited to 'lib/output/base.js')
-rw-r--r-- | lib/output/base.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/output/base.js b/lib/output/base.js index fdddfe8..77c2d9f 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -96,6 +96,16 @@ Output.prototype.generate = function() { }); }) + // Generate sub-books + .then(function() { + if (!that.book.isMultilingual()) return; + + return Promise.serie(that.book.books, function(subbook) { + var out = that.onLanguageBook(subbook); + return out.generate(); + }); + }) + // Finish the generation .then(function() { that.log.debug.ln('finishing the generation'); @@ -179,6 +189,11 @@ Output.prototype.onResolveTemplate = function(from, to) { return path.resolve(path.dirname(from), to); }; +// Prepare output for a language book +Output.prototype.onLanguageBook = function(book) { + return new this.constructor(book, this.opts); +}; + // ---- Utilities ---- |