diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-24 18:54:20 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-24 18:54:20 +0100 |
commit | 1583ede3d7ae005f7bd399ab587ca9bddfe845ca (patch) | |
tree | 51620a7fa837c1160ef3c81d29b16211c8bbe6b5 /lib/index.js | |
parent | 572994a17e24b51624437e5b0f5da44a6156ffd7 (diff) | |
download | gitbook-1583ede3d7ae005f7bd399ab587ca9bddfe845ca.zip gitbook-1583ede3d7ae005f7bd399ab587ca9bddfe845ca.tar.gz gitbook-1583ede3d7ae005f7bd399ab587ca9bddfe845ca.tar.bz2 |
Add Book.generateFile to output a pdf
Diffstat (limited to 'lib/index.js')
-rw-r--r-- | lib/index.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/index.js b/lib/index.js index 44574fd..7d5fb25 100644 --- a/lib/index.js +++ b/lib/index.js @@ -53,6 +53,30 @@ module.exports = { } }, + // Build an ebook and output it + { + name: "pdf [book] [output]", + description: "build a book to pdf", + options: [ + LOG_OPTION + ], + exec: function(args, kwargs) { + var input = args[0] || process.cwd(); + var output = args[1]; + + var book = new Book(input, _.extend({}, { + 'logLevel': Book.LOG_LEVELS[(kwargs.log).toUpperCase()] + })); + + return book.parse() + .then(function() { + return book.generateFile(output, { + ebookFormat: "pdf" + }); + }); + } + }, + // Build and serve a book { name: "serve [book]", |