diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-12 14:29:25 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-05-12 14:29:25 +0200 |
commit | 26acab4dfb9837df5d775e85b2f308956c732972 (patch) | |
tree | 980de11dc74239e620ac0d8c0f6325eb62be886b /lib/cli | |
parent | d4b562e001f35467f97a9463607e56371c76b6dc (diff) | |
download | gitbook-26acab4dfb9837df5d775e85b2f308956c732972.zip gitbook-26acab4dfb9837df5d775e85b2f308956c732972.tar.gz gitbook-26acab4dfb9837df5d775e85b2f308956c732972.tar.bz2 |
Fix generation of ebook for multilingual book (gitbook pdf)
Diffstat (limited to 'lib/cli')
-rw-r--r-- | lib/cli/buildEbook.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/cli/buildEbook.js b/lib/cli/buildEbook.js index 405d838..a87fac7 100644 --- a/lib/cli/buildEbook.js +++ b/lib/cli/buildEbook.js @@ -18,8 +18,10 @@ module.exports = function(format) { options.log ], exec: function(args, kwargs) { + var extension = '.' + format; + // Output file will be stored in - var outputFile = args[1] || ('book.' + format); + var outputFile = args[1] || ('book' + extension); // Create temporary directory var outputFolder = tmp.dirSync().name; @@ -42,23 +44,23 @@ module.exports = function(format) { var languages = book.getLanguages(); if (book.isMultilingual()) { - return Promise.ForEach(languages, function(lang) { + return Promise.forEach(languages.getList(), function(lang) { var langID = lang.getID(); var langOutputFile = path.join( path.dirname(outputFile), - path.basename(outputFile, format) + '_' + langID + '.' + format + path.basename(outputFile, extension) + '_' + langID + extension ); return fs.copy( - path.resolve(outputFolder, langID, 'index.' + format), + path.resolve(outputFolder, langID, 'index' + extension), langOutputFile ); }) .thenResolve(languages.getCount()); } else { return fs.copy( - path.resolve(outputFolder, 'index.' + format), + path.resolve(outputFolder, 'index' + extension), outputFile ).thenResolve(1); } |