mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
Disable directoryIndex for ebook generation
This commit is contained in:
+2
-2
@@ -19,7 +19,7 @@ function Output(book, opts) {
|
||||
_.bindAll(this);
|
||||
|
||||
this.opts = _.defaults(opts || {}, {
|
||||
|
||||
directoryIndex: true
|
||||
});
|
||||
|
||||
this.book = book;
|
||||
@@ -222,7 +222,7 @@ Output.prototype.outputPath = function(filename, ext) {
|
||||
Output.prototype.outputUrl = function(filename, ext) {
|
||||
var href = this.outputPath(filename, ext);
|
||||
|
||||
if (path.basename(href) == 'index.html') {
|
||||
if (path.basename(href) == 'index.html' && this.opts.directoryIndex) {
|
||||
href = path.dirname(href) + '/';
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ var assetsInliner = require('./assets-inliner');
|
||||
|
||||
function _EbookOutput() {
|
||||
WebsiteOutput.apply(this, arguments);
|
||||
|
||||
// ebook-convert does not support link like "./"
|
||||
this.opts.directoryIndex = false;
|
||||
}
|
||||
util.inherits(_EbookOutput, WebsiteOutput);
|
||||
|
||||
|
||||
@@ -103,8 +103,10 @@ WebsiteOutput.prototype.prepare = function() {
|
||||
|
||||
// Relase path to an asset
|
||||
that.env.addFilter('resolveAsset', function(href) {
|
||||
href = path.join('/gitbook', href);
|
||||
return that.resolveForPage(this.ctx.file.path, href);
|
||||
href = path.join('gitbook', href);
|
||||
if (!this.ctx.file) return href;
|
||||
|
||||
return that.resolveForPage(this.ctx.file.path, '/' + href);
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user