diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/backbone/summary.js | 17 | ||||
-rw-r--r-- | lib/config/schema.js | 4 | ||||
-rw-r--r-- | lib/init.js | 1 | ||||
-rw-r--r-- | lib/output/ebook.js | 2 | ||||
-rw-r--r-- | lib/plugins/plugin.js | 1 | ||||
-rw-r--r-- | lib/template/index.js | 2 | ||||
-rw-r--r-- | lib/utils/command.js | 2 |
7 files changed, 9 insertions, 20 deletions
diff --git a/lib/backbone/summary.js b/lib/backbone/summary.js index 5a2f7f2..9c8a38d 100644 --- a/lib/backbone/summary.js +++ b/lib/backbone/summary.js @@ -1,6 +1,5 @@ var _ = require('lodash'); var util = require('util'); -var url = require('url'); var location = require('../utils/location'); var error = require('../utils/error'); @@ -32,17 +31,13 @@ function TOCArticle(def, parent) { // Path can be a relative path or an url, or nothing this.ref = def.path; - if (this.ref) { - var parts = url.parse(this.ref); + if (this.ref && !this.isExternal()) { + var parts = this.ref.split('#'); + this.path = (parts.length > 1? parts.slice(0, -1).join('#') : this.ref); + this.anchor = (parts.length > 1? '#' + _.last(parts) : null); - if (!this.isExternal()) { - var parts = this.ref.split('#'); - this.path = (parts.length > 1? parts.slice(0, -1).join('#') : this.ref); - this.anchor = (parts.length > 1? '#' + _.last(parts) : null); - - // Normalize path to remove ('./', etc) - this.path = location.normalize(this.path); - } + // Normalize path to remove ('./', etc) + this.path = location.normalize(this.path); } this.articles = _.map(def.articles || [], function(article) { diff --git a/lib/config/schema.js b/lib/config/schema.js index d3088f5..3fb2050 100644 --- a/lib/config/schema.js +++ b/lib/config/schema.js @@ -12,10 +12,6 @@ module.exports = { 'type': 'string', 'title': 'Title of the book, default is extracted from README' }, - 'title': { - 'type': 'string', - 'title': 'Description of the book, default is extracted from README' - }, 'isbn': { 'type': 'string', 'title': 'ISBN for published book' diff --git a/lib/init.js b/lib/init.js index ea75a77..b7bb7f5 100644 --- a/lib/init.js +++ b/lib/init.js @@ -1,4 +1,3 @@ -var _ = require('lodash'); var path = require('path'); var fs = require('./utils/fs'); diff --git a/lib/output/ebook.js b/lib/output/ebook.js index 228a025..ace5255 100644 --- a/lib/output/ebook.js +++ b/lib/output/ebook.js @@ -114,7 +114,7 @@ EbookOutput.prototype.locateCover = function() { // Cover doesn't exist and multilingual? if (!fs.existsSync(cover)) { - if (this.parent) return this.parent.locateCover() + if (this.parent) return this.parent.locateCover(); else return undefined; } diff --git a/lib/plugins/plugin.js b/lib/plugins/plugin.js index f678111..d707e5c 100644 --- a/lib/plugins/plugin.js +++ b/lib/plugins/plugin.js @@ -204,7 +204,6 @@ BookPlugin.prototype._getResources = function(base) { .then(function() { if (that._resources[base]) return that._resources[base]; - base = base; var book = that.content[base]; // Compatibility with version 1.x.x diff --git a/lib/template/index.js b/lib/template/index.js index fc7603d..eb62549 100644 --- a/lib/template/index.js +++ b/lib/template/index.js @@ -202,7 +202,7 @@ TemplateEngine.prototype.addBlock = function(name, block) { lastBlockArgs = parser.parseSignature(null, true); parser.advanceAfterBlockEnd(lastBlockName); } - } while (lastBlockName != block.end) + } while (lastBlockName != block.end); parser.advanceAfterBlockEnd(); diff --git a/lib/utils/command.js b/lib/utils/command.js index de240df..93df750 100644 --- a/lib/utils/command.js +++ b/lib/utils/command.js @@ -1,6 +1,6 @@ var _ = require('lodash'); var childProcess = require('child_process'); -var spawn = require("spawn-cmd").spawn; +var spawn = require('spawn-cmd').spawn; var Promise = require('./promise'); // Execute a command |