diff options
Diffstat (limited to 'lib/backbone/page.js')
-rw-r--r-- | lib/backbone/page.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/backbone/page.js b/lib/backbone/page.js index a17e413..bf3494a 100644 --- a/lib/backbone/page.js +++ b/lib/backbone/page.js @@ -5,7 +5,7 @@ A page represent a parsable file in the book (Markdown, Asciidoc, etc) */ function Page(book, filename) { - if (!(this instanceof Page)) return new Page(); + if (!(this instanceof Page)) return new Page(book, filename); this.book = book; this.filename = filename; @@ -20,5 +20,10 @@ Page.prototype.withExtension = function(ext) { ); }; +// Read the page as a string +Page.prototype.read = function() { + return this.book.readFile(this.filename); +}; + module.exports = Page; |