diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-03-28 15:54:34 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-03-28 15:54:34 +0100 |
commit | 3065742b73ae6ad0f8aa75eb0eafcdd8e395a108 (patch) | |
tree | ce9a56d50bff13f2187b643df3a72a667ebf12a4 | |
parent | ffd69ad1f2f869796f10c425e67680fd7f223ff5 (diff) | |
download | gitbook-3065742b73ae6ad0f8aa75eb0eafcdd8e395a108.zip gitbook-3065742b73ae6ad0f8aa75eb0eafcdd8e395a108.tar.gz gitbook-3065742b73ae6ad0f8aa75eb0eafcdd8e395a108.tar.bz2 |
Separate book.contentLink and book.contentPath
-rw-r--r-- | lib/book.js | 9 | ||||
-rw-r--r-- | lib/generators/website.js | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/book.js b/lib/book.js index bdd4dfc..42e2c23 100644 --- a/lib/book.js +++ b/lib/book.js @@ -675,8 +675,8 @@ Book.prototype.resolve = function(p) { return path.resolve(this.root, p); }; -// Normalize a link to .html and convert README -> index -Book.prototype.contentLink = function(link) { +// Normalize a path to .html and convert README -> index +Book.prototype.contentPath = function(link) { if ( path.basename(link, path.extname(link)) == "README" || link == this.readmeFile @@ -688,6 +688,11 @@ Book.prototype.contentLink = function(link) { return link; } +// Normalize a link to .html and convert README -> index +Book.prototype.contentLink = function(link) { + return links.normalize(this.contentPath(link)); +} + // Index a page into the search index Book.prototype.indexPage = function(page) { var nav = this.navigation[page.path]; diff --git a/lib/generators/website.js b/lib/generators/website.js index d1e92a0..9405a1c 100644 --- a/lib/generators/website.js +++ b/lib/generators/website.js @@ -136,7 +136,7 @@ Generator.prototype.convertFile = function(input) { } }) .then(function(page) { - var relativeOutput = that.book.contentLink(page.path); + var relativeOutput = that.book.contentPath(page.path); var output = path.join(that.options.output, relativeOutput); var basePath = path.relative(path.dirname(output), that.options.output) || "."; |