diff options
Diffstat (limited to 'lib/book.js')
-rw-r--r-- | lib/book.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/book.js b/lib/book.js index 3ad302a..19b5f43 100644 --- a/lib/book.js +++ b/lib/book.js @@ -108,7 +108,8 @@ Book.prototype.parse = function() { // Generate the output Book.prototype.generate = function(generator) { - var that = this, generator; + var that = this; + that.options.generator = generator || that.options.generator; return Q() @@ -122,14 +123,14 @@ Book.prototype.generate = function(generator) { // Create generator .then(function() { - generator = generator || that.options.generator; var Generator = generators[generator]; - if (!Generator) throw "Generator '"+generator+"' doesn't exist"; + if (!Generator) throw "Generator '"+that.options.generator+"' doesn't exist"; generator = new Generator(that); return generator.load(); }) + // Generate content .then(function() { if (that.isMultilingual()) { return that.generateMultiLingual(generator); @@ -177,9 +178,12 @@ Book.prototype.generateMultiLingual = function(generator) { // Generate sub-books return _.reduce(that.books, function(prev, book) { return prev.then(function() { - return book.generate(); + return book.generate(that.options.generator); }); }, Q()); + }) + .then(function() { + return generator.langsIndex(that.langs); }); }; |