summaryrefslogtreecommitdiffstats
path: root/lib/backbone/page.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/backbone/page.js')
-rw-r--r--lib/backbone/page.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/backbone/page.js b/lib/backbone/page.js
index 33bd636..a17e413 100644
--- a/lib/backbone/page.js
+++ b/lib/backbone/page.js
@@ -1,3 +1,4 @@
+var path = require('path');
/*
A page represent a parsable file in the book (Markdown, Asciidoc, etc)
@@ -11,8 +12,12 @@ function Page(book, filename) {
}
// Return the filename of the page with another extension
+// "README.md" -> "README.html"
Page.prototype.withExtension = function(ext) {
- return
+ return path.join(
+ path.dirname(this.filename),
+ path.basename(this.filename, path.extname(this.filename)) + ext
+ );
};