diff options
Diffstat (limited to 'lib/models/book.js')
-rw-r--r-- | lib/models/book.js | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/models/book.js b/lib/models/book.js index fed66f9..f774ee8 100644 --- a/lib/models/book.js +++ b/lib/models/book.js @@ -293,26 +293,47 @@ Book.prototype.getDefaultExt = function() { /** Infer the default path for a Readme. + @param {Boolean} [absolute=false] False for a path relative to + this book's content root @return {String} */ -Book.prototype.getDefaultReadmePath = function() { - return this.getContentRoot()+'README'+this.getDefaultExt(); +Book.prototype.getDefaultReadmePath = function(absolute) { + var defaultPath = 'README'+this.getDefaultExt(); + if (absolute) { + return path.join(this.getContentRoot(), defaultPath); + } else { + return defaultPath; + } }; /** Infer the default path for a Summary. + @param {Boolean} [absolute=false] False for a path relative to + this book's content root @return {String} */ -Book.prototype.getDefaultSummaryPath = function() { - return this.getContentRoot()+'SUMMARY'+this.getDefaultExt(); +Book.prototype.getDefaultSummaryPath = function(absolute) { + var defaultPath = 'SUMMARY'+this.getDefaultExt(); + if (absolute) { + return path.join(this.getContentRoot(), defaultPath); + } else { + return defaultPath; + } }; /** Infer the default path for a Glossary. + @param {Boolean} [absolute=false] False for a path relative to + this book's content root @return {String} */ -Book.prototype.getDefaultGlossaryPath = function() { - return this.getContentRoot()+'GLOSSARY'+this.getDefaultExt(); +Book.prototype.getDefaultGlossaryPath = function(absolute) { + var defaultPath = 'GLOSSARY'+this.getDefaultExt(); + if (absolute) { + return path.join(this.getContentRoot(), defaultPath); + } else { + return defaultPath; + } }; /** |