Add toc at the end of pdf

This commit is contained in:
Samy Pessé
2014-05-29 18:33:05 +02:00
parent f4a17b182f
commit 9f00bf8060
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -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"),
+1
View File
@@ -12,6 +12,7 @@ function optionsToShellArgs(options) {
return _.chain(options)
.map(function(value, key) {
if (value == null) return null;
if (value == true) return key;
return key+"="+escapeShellArg(value);
})
.compact()