summaryrefslogtreecommitdiffstats
path: root/lib/output
diff options
context:
space:
mode:
Diffstat (limited to 'lib/output')
-rw-r--r--lib/output/assets-inliner.js2
-rw-r--r--lib/output/base.js12
-rw-r--r--lib/output/website.js2
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