mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
Fix linting errors
This commit is contained in:
+6
-11
@@ -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) {
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
var _ = require('lodash');
|
||||
var path = require('path');
|
||||
|
||||
var fs = require('./utils/fs');
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+3
-3
@@ -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');
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
var path = require('path');
|
||||
var should = require('should');
|
||||
|
||||
var Book = require('../').Book;
|
||||
var mock = require('./mock');
|
||||
|
||||
describe('Locate', function() {
|
||||
|
||||
Reference in New Issue
Block a user