diff options
Diffstat (limited to 'lib/page/index.js')
-rw-r--r-- | lib/page/index.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/page/index.js b/lib/page/index.js index e96f89b..77b9950 100644 --- a/lib/page/index.js +++ b/lib/page/index.js @@ -78,6 +78,14 @@ Page.prototype.resolve = function() { return this.book.resolve(this.resolveLocal.apply(this, arguments)); }; +// Convert an absolite path to a relative path from this page +Page.prototype.relative = function(name) { + return location.relative( + this.resolve('.'), + this.resolve(name) + ); +}; + // Update content of the page Page.prototype.update = function(content) { this.content = content; |