diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-18 14:47:53 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-18 14:47:53 +0100 |
commit | 709b388dfcc641fab25d297618b6ffe49f5cd677 (patch) | |
tree | 661973ac5d7de4bb32db33648ecb23e9bba6b00e /lib/output | |
parent | 6e83240233e6168aa6567eb6fcac62508fe7fd0e (diff) | |
download | gitbook-709b388dfcc641fab25d297618b6ffe49f5cd677.zip gitbook-709b388dfcc641fab25d297618b6ffe49f5cd677.tar.gz gitbook-709b388dfcc641fab25d297618b6ffe49f5cd677.tar.bz2 |
Fix path calcul to be coherant
Diffstat (limited to 'lib/output')
-rw-r--r-- | lib/output/assets-inliner.js | 2 | ||||
-rw-r--r-- | lib/output/base.js | 12 | ||||
-rw-r--r-- | lib/output/website.js | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/output/assets-inliner.js b/lib/output/assets-inliner.js index 8d7c48e..6768830 100644 --- a/lib/output/assets-inliner.js +++ b/lib/output/assets-inliner.js @@ -73,7 +73,7 @@ module.exports = function assetsInliner(Base) { // Return relative path from the page .then(function(filename) { - return page.relative('/' + filename); + return page.relative(filename); }); }; diff --git a/lib/output/base.js b/lib/output/base.js index d22fda1..6678bb0 100644 --- a/lib/output/base.js +++ b/lib/output/base.js @@ -130,10 +130,18 @@ Output.prototype.finish = function() { // Resolve an HTML link Output.prototype.onRelativeLink = function(currentPage, href) { - var to = this.book.getPage(href); + var to = currentPage.followPage(href); // Replace by an .html link - if (to) href = this.outputUrl(to.path); + if (to) { + href = to.path; + + // Recalcul as relative link + href = currentPage.relative(href); + + // Replace .md by .html + href = this.outputUrl(href); + } return href; }; diff --git a/lib/output/website.js b/lib/output/website.js index b595897..d856229 100644 --- a/lib/output/website.js +++ b/lib/output/website.js @@ -87,7 +87,7 @@ WebsiteOutput.prototype.prepare = function() { // Transform a '.md' into a '.html' (README -> index) that.env.addFilter('contentURL', function(s) { - return that.onRelativeLink(null, s); + return that.outputUrl(s); }); // Relase path to an asset |