summaryrefslogtreecommitdiffstats
path: root/lib/backbone
diff options
context:
space:
mode:
Diffstat (limited to 'lib/backbone')
-rw-r--r--lib/backbone/file.js3
-rw-r--r--lib/backbone/page.js7
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/backbone/file.js b/lib/backbone/file.js
index 34cf066..a58063c 100644
--- a/lib/backbone/file.js
+++ b/lib/backbone/file.js
@@ -1,3 +1,4 @@
+var _ = require('lodash');
function BackboneFile(book) {
if (!(this instanceof BackboneFile)) return new BackboneFile(book);
@@ -8,6 +9,8 @@ function BackboneFile(book) {
// Filename in the book
this.filename = '';
this.parser;
+
+ _.bindAll(this);
}
// Type of the backbone file
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
+ );
};