diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-22 22:31:47 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-22 22:31:47 +0100 |
commit | 74ea419c530921374ffbe893f01b6a4695995349 (patch) | |
tree | eb58ec1c960f2747831cfae0dcee2d0447b3705a /lib/generators/site.js | |
parent | 0c8513801c131ec6e2c7b348403a4c66a9bf2a11 (diff) | |
download | gitbook-74ea419c530921374ffbe893f01b6a4695995349.zip gitbook-74ea419c530921374ffbe893f01b6a4695995349.tar.gz gitbook-74ea419c530921374ffbe893f01b6a4695995349.tar.bz2 |
Write search index to output folder
Diffstat (limited to 'lib/generators/site.js')
-rw-r--r-- | lib/generators/site.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/generators/site.js b/lib/generators/site.js index 51a6cb3..9b7dbcb 100644 --- a/lib/generators/site.js +++ b/lib/generators/site.js @@ -90,6 +90,7 @@ Generator.prototype.finish = function() { return this.copyAssets() .then(this.copyCover) .then(this.writeGlossary) + .then(this.writeSearchIndex); }; // Normalize a link to .html and convert README -> index @@ -148,6 +149,16 @@ Generator.prototype.writeGlossary = function() { return this._writeTemplate(this.glossaryTemplate, {}, path.join(this.options.output, "GLOSSARY.html")); }; +// Write the search index +Generator.prototype.writeSearchIndex = function() { + var that = this; + + return fs.writeFile( + path.join(this.options.output, "search_index.json"), + JSON.stringify(this.book.searchIndex) + ); +}; + // Convert a page into a normalized data set Generator.prototype.normalizePage = function(page) { var that = this; |