summaryrefslogtreecommitdiffstats
path: root/lib/output/website.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/website.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/website.js')
-rw-r--r--lib/output/website.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/output/website.js b/lib/output/website.js
index a208802..f58c68f 100644
--- a/lib/output/website.js
+++ b/lib/output/website.js
@@ -77,15 +77,20 @@ WebsiteOutput.prototype.prepare = function() {
// Transform an absolute path into a relative path
// using this.ctx.page.path
- that.env.addFilter('resolveFile', function(s) {
- // todo
- return s;
+ that.env.addFilter('resolveFile', function(href) {
+ return that.resolveForPage(this.ctx.file.path, href);
});
// Transform a '.md' into a '.html' (README -> index)
that.env.addFilter('contentURL', function(s) {
return that.onRelativeLink(null, s);
});
+
+ // Relase path to an asset
+ that.env.addFilter('resolveAsset', function(href) {
+ href = path.join('/gitbook', href);
+ return that.resolveForPage(this.ctx.file.path, href);
+ });
});
};