summaryrefslogtreecommitdiffstats
path: root/lib/generate/ebook/index.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-05-29 18:33:05 +0200
committerSamy Pessé <samypesse@gmail.com>2014-05-29 18:33:05 +0200
commit9f00bf80604d49527ec057e4afc0f47612ad025b (patch)
tree6173bd52388329862fbf525158cc6949d39099eb /lib/generate/ebook/index.js
parentf4a17b182fb28f686693659983d82797ce93330b (diff)
downloadgitbook-9f00bf80604d49527ec057e4afc0f47612ad025b.zip
gitbook-9f00bf80604d49527ec057e4afc0f47612ad025b.tar.gz
gitbook-9f00bf80604d49527ec057e4afc0f47612ad025b.tar.bz2
Add toc at the end of pdf
Diffstat (limited to 'lib/generate/ebook/index.js')
-rw-r--r--lib/generate/ebook/index.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/generate/ebook/index.js b/lib/generate/ebook/index.js
index 2d9c1ae..a02d877 100644
--- a/lib/generate/ebook/index.js
+++ b/lib/generate/ebook/index.js
@@ -29,6 +29,7 @@ Generator.prototype.finish = function() {
return BaseGenerator.prototype.finish.apply(this)
.then(function() {
var d = Q.defer();
+ var format = that.options.extension || path.extname(that.options.output);
if (!that.options.cover && fs.existsSync(path.join(that.options.output, "cover.jpg"))) {
that.options.cover = path.join(that.options.output, "cover.jpg");
@@ -44,6 +45,10 @@ Generator.prototype.finish = function() {
"--level3-toc": "descendant-or-self::*[contains(concat(' ', normalize-space(@class), ' '), ' book-chapter-3 ')]"
};
+ if (format == "pdf") {
+ _options["--pdf-add-toc"] = true;
+ }
+
var command = [
"ebook-convert",
path.join(that.options.output, "index.html"),