diff options
Diffstat (limited to 'lib/generators/ebook.js')
-rw-r--r-- | lib/generators/ebook.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/generators/ebook.js b/lib/generators/ebook.js index cdb667c..e6a33d3 100644 --- a/lib/generators/ebook.js +++ b/lib/generators/ebook.js @@ -2,7 +2,7 @@ var util = require("util"); var path = require("path"); var Q = require("q"); var _ = require("lodash"); -var exec = require('child_process').exec; +var exec = require("child_process").exec; var fs = require("../utils/fs"); var stringUtils = require("../utils/string"); @@ -26,9 +26,9 @@ var Generator = function(book, format) { util.inherits(Generator, BaseGenerator); Generator.prototype.prepareTemplates = function() { - this.templates["page"] = this.book.plugins.template("ebook:page") || path.resolve(this.options.theme, 'templates/ebook/page.html'); - this.templates["summary"] = this.book.plugins.template("ebook:summary") || path.resolve(this.options.theme, 'templates/ebook/summary.html'); - this.templates["glossary"] = this.book.plugins.template("ebook:glossary") || path.resolve(this.options.theme, 'templates/ebook/glossary.html'); + this.templates.page = this.book.plugins.template("ebook:page") || path.resolve(this.options.theme, "templates/ebook/page.html"); + this.templates.summary = this.book.plugins.template("ebook:summary") || path.resolve(this.options.theme, "templates/ebook/summary.html"); + this.templates.glossary = this.book.plugins.template("ebook:glossary") || path.resolve(this.options.theme, "templates/ebook/glossary.html"); return Q(); }; @@ -38,7 +38,7 @@ Generator.prototype.writeSummary = function() { var that = this; that.book.log.info.ln("write SUMMARY.html"); - return this._writeTemplate(this.templates["summary"], {}, path.join(this.options.output, "SUMMARY.html")); + return this._writeTemplate(this.templates.summary, {}, path.join(this.options.output, "SUMMARY.html")); }; Generator.prototype.finish = function() { @@ -52,12 +52,12 @@ Generator.prototype.finish = function() { .then(function() { if (!that.ebookFormat) return Q(); - var d = Q.defer(); - if (!that.options.cover && fs.existsSync(path.join(that.options.output, "cover.jpg"))) { that.options.cover = path.join(that.options.output, "cover.jpg"); } + var d = Q.defer(); + var _options = { "--cover": that.options.cover, "--title": that.options.title, @@ -108,7 +108,7 @@ Generator.prototype.finish = function() { that.book.log.info("start conversion to", that.ebookFormat, "...."); - var child = exec(command, function (error, stdout, stderr) { + var child = exec(command, function (error, stdout) { if (error) { that.book.log.info.fail(); @@ -124,11 +124,11 @@ Generator.prototype.finish = function() { d.resolve(); }); - child.stdout.on('data', function (data) { + child.stdout.on("data", function (data) { that.book.log.debug(data); }); - child.stderr.on('data', function (data) { + child.stderr.on("data", function (data) { that.book.log.debug(data); }); |