summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-03-07 10:40:25 +0100
committerSamy Pessé <samypesse@gmail.com>2016-03-07 10:40:25 +0100
commitb4bdf97cfe84994a4e2e04f196e0ebb4849b188f (patch)
treeeabe2904fb68684960c469a6286f1628eaea0bd0
parentbf98984012c493aebb2258902e1722f0ed0d3527 (diff)
downloadgitbook-b4bdf97cfe84994a4e2e04f196e0ebb4849b188f.zip
gitbook-b4bdf97cfe84994a4e2e04f196e0ebb4849b188f.tar.gz
gitbook-b4bdf97cfe84994a4e2e04f196e0ebb4849b188f.tar.bz2
Fix linting errors
-rw-r--r--lib/backbone/summary.js17
-rw-r--r--lib/config/schema.js4
-rw-r--r--lib/init.js1
-rw-r--r--lib/output/ebook.js2
-rw-r--r--lib/plugins/plugin.js1
-rw-r--r--lib/template/index.js2
-rw-r--r--lib/utils/command.js2
-rw-r--r--test/init.js6
-rw-r--r--test/locate.js1
9 files changed, 12 insertions, 24 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
diff --git a/test/init.js b/test/init.js
index e1e8a4a..200f795 100644
--- a/test/init.js
+++ b/test/init.js
@@ -19,7 +19,7 @@ describe('Init', function() {
rootFolder.should.have.file('hello.md');
rootFolder.should.have.file('hello 2.md');
});
- })
+ });
});
it('should create file subfolder', function() {
@@ -38,7 +38,7 @@ describe('Init', function() {
rootFolder.should.have.file('test/hello.md');
rootFolder.should.have.file('test/test2/world.md');
});
- })
+ });
});
it('should create SUMMARY if non-existant', function() {
@@ -51,7 +51,7 @@ describe('Init', function() {
rootFolder.should.have.file('SUMMARY.md');
rootFolder.should.have.file('README.md');
});
- })
+ });
});
});
diff --git a/test/locate.js b/test/locate.js
index 2b6a574..f9adcd7 100644
--- a/test/locate.js
+++ b/test/locate.js
@@ -1,7 +1,6 @@
var path = require('path');
var should = require('should');
-var Book = require('../').Book;
var mock = require('./mock');
describe('Locate', function() {