diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-06-02 17:49:05 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-06-02 17:49:05 +0200 |
commit | 5f207f5e146d1e1cdcb8aa1e2545323e10a906bd (patch) | |
tree | 74cf245a5384ab1c866b1147a4ca4b8c0fd16043 | |
parent | 718692de3b4725caa41a7c2371acf634d149e5f7 (diff) | |
download | gitbook-5f207f5e146d1e1cdcb8aa1e2545323e10a906bd.zip gitbook-5f207f5e146d1e1cdcb8aa1e2545323e10a906bd.tar.gz gitbook-5f207f5e146d1e1cdcb8aa1e2545323e10a906bd.tar.bz2 |
Add options pdf.toc and pdf.fontSize
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | lib/generate/ebook/index.js | 8 |
2 files changed, 16 insertions, 2 deletions
@@ -98,6 +98,16 @@ Here are the options that can be stored in this file: "facebook": null, "twitter": null } + }, + + + // Options for PDF generation + "pdf": { + // Add toc at the end of the file + "toc": true, + + // Font size for the fiel content + "fontSize": 12 } } ``` diff --git a/lib/generate/ebook/index.js b/lib/generate/ebook/index.js index 0c5a664..0cde1a9 100644 --- a/lib/generate/ebook/index.js +++ b/lib/generate/ebook/index.js @@ -30,6 +30,10 @@ Generator.prototype.finish = function() { .then(function() { var d = Q.defer(); var format = that.options.extension || path.extname(that.options.output); + var pdfOptions = _.defaults(that.options.pdf || {}, { + "fontSize": 12, + "toc": true + }); if (!that.options.cover && fs.existsSync(path.join(that.options.output, "cover.jpg"))) { that.options.cover = path.join(that.options.output, "cover.jpg"); @@ -51,8 +55,8 @@ Generator.prototype.finish = function() { "--margin-right": "62", "--margin-top": "36", "--margin-bottom": "36", - "--pdf-add-toc": true, - "--pdf-default-font-size": "12", + "--pdf-add-toc": Boolean(pdfOptions.toc), + "--pdf-default-font-size": String(pdfOptions.fontSize), "--paper-size": "a4", }); } |