diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-22 22:46:35 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-22 22:46:35 +0100 |
commit | 322cf59a3404fb687e3fc996e18bf91f09196c52 (patch) | |
tree | 0173697914d20349e3a8425540e476f6936cd3d4 /lib/generators/site.js | |
parent | 66841b1bb742498b6805b018cac74c4c94b98a72 (diff) | |
download | gitbook-322cf59a3404fb687e3fc996e18bf91f09196c52.zip gitbook-322cf59a3404fb687e3fc996e18bf91f09196c52.tar.gz gitbook-322cf59a3404fb687e3fc996e18bf91f09196c52.tar.bz2 |
Use html link in search index
Diffstat (limited to 'lib/generators/site.js')
-rw-r--r-- | lib/generators/site.js | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/generators/site.js b/lib/generators/site.js index 9b7dbcb..6db2fa4 100644 --- a/lib/generators/site.js +++ b/lib/generators/site.js @@ -73,7 +73,7 @@ Generator.prototype.prepareTemplates = function() { ); // Add filter - this.env.addFilter("contentLink", this.contentLink.bind(this)); + this.env.addFilter("contentLink", this.book.contentLink.bind(this.book)); this.env.addFilter('lvl', function(lvl) { return lvl.split(".").length; }); @@ -93,24 +93,11 @@ Generator.prototype.finish = function() { .then(this.writeSearchIndex); }; -// Normalize a link to .html and convert README -> index -Generator.prototype.contentLink = function(link) { - if ( - path.basename(link) == "README" - || link == this.book.readmeFile - ) { - link = path.join(path.dirname(link), "index"+path.extname(link)); - } - - link = links.changeExtension(link, ".html"); - return link; -} - // Convert an input file Generator.prototype.writeParsedFile = function(page) { var that = this; - var output = this.contentLink(page.path); + var output = this.book.contentLink(page.path); output = path.join(that.options.output, output); var basePath = path.relative(path.dirname(output), this.options.output) || "."; |