summaryrefslogtreecommitdiffstats
path: root/lib/output/base.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-18 14:47:53 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-18 14:47:53 +0100
commit709b388dfcc641fab25d297618b6ffe49f5cd677 (patch)
tree661973ac5d7de4bb32db33648ecb23e9bba6b00e /lib/output/base.js
parent6e83240233e6168aa6567eb6fcac62508fe7fd0e (diff)
downloadgitbook-709b388dfcc641fab25d297618b6ffe49f5cd677.zip
gitbook-709b388dfcc641fab25d297618b6ffe49f5cd677.tar.gz
gitbook-709b388dfcc641fab25d297618b6ffe49f5cd677.tar.bz2
Fix path calcul to be coherant
Diffstat (limited to 'lib/output/base.js')
-rw-r--r--lib/output/base.js12
1 files changed, 10 insertions, 2 deletions
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;
};