summaryrefslogtreecommitdiffstats
path: root/lib/output/base.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-18 10:04:23 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-18 10:04:23 +0100
commitb66242db985fd8d6088b52d4b089f0de2ecb8058 (patch)
treee11467b9ada96d5fdd510b2d3a08ceae8b575329 /lib/output/base.js
parent004ac8851622cb4583b5569ae3480344855a7880 (diff)
downloadgitbook-b66242db985fd8d6088b52d4b089f0de2ecb8058.zip
gitbook-b66242db985fd8d6088b52d4b089f0de2ecb8058.tar.gz
gitbook-b66242db985fd8d6088b52d4b089f0de2ecb8058.tar.bz2
Add filter resolveAsset to template for website
Diffstat (limited to 'lib/output/base.js')
-rw-r--r--lib/output/base.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/output/base.js b/lib/output/base.js
index 7b527da..e674f46 100644
--- a/lib/output/base.js
+++ b/lib/output/base.js
@@ -173,6 +173,14 @@ Output.prototype.getPageContext = function(page) {
);
};
+// Resolve a file path in the context of a specific page
+// Result is an "absolute path relative to the output folder"
+Output.prototype.resolveForPage = function(page, href) {
+ if (_.isString(page)) page = this.book.getPage(page);
+
+ href = page.relative(href);
+ return this.onRelativeLink(page, href);
+};
// Filename for output
// READMEs are replaced by index.html