summaryrefslogtreecommitdiffstats
path: root/lib/backbone/page.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-01-28 18:39:44 +0100
committerSamy Pessé <samypesse@gmail.com>2016-01-28 18:39:44 +0100
commit4b465bedea94688a9adfb9136c9d2970d5496274 (patch)
tree7e29cc10d07b86d86239bd1cd59fab7996b412ce /lib/backbone/page.js
parent461ef2c68e9086bd77f0a25d57956ebf60308f7c (diff)
downloadgitbook-4b465bedea94688a9adfb9136c9d2970d5496274.zip
gitbook-4b465bedea94688a9adfb9136c9d2970d5496274.tar.gz
gitbook-4b465bedea94688a9adfb9136c9d2970d5496274.tar.bz2
Fix tests for languages parsing
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
+ );
};