diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-02-12 20:48:51 +0100 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-02-12 20:48:51 +0100 |
commit | 82f94b010f1d77957c9d1b0967dcdd5eafe73c39 (patch) | |
tree | c13607b4bbdf20eb589052dc785edb6e70d6e031 /lib/generators/json.js | |
parent | 4555c541a8f98cb6ad4cbec2d7bf85b375dbf505 (diff) | |
download | gitbook-82f94b010f1d77957c9d1b0967dcdd5eafe73c39.zip gitbook-82f94b010f1d77957c9d1b0967dcdd5eafe73c39.tar.gz gitbook-82f94b010f1d77957c9d1b0967dcdd5eafe73c39.tar.bz2 |
Remove concept of generator, to merge it with Output
Diffstat (limited to 'lib/generators/json.js')
-rw-r--r-- | lib/generators/json.js | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/lib/generators/json.js b/lib/generators/json.js deleted file mode 100644 index 5ba2d16..0000000 --- a/lib/generators/json.js +++ /dev/null @@ -1,47 +0,0 @@ -var util = require('util'); -var Generator = require('./base'); -var gitbook = require('../gitbook'); - -function JSONGenerator() { - Generator.apply(this, arguments); -} -util.inherits(JSONGenerator, Generator); - -// Write a page (parsable file) -JSONGenerator.prototype.writePage = function(page) { - var that = this; - - // Parse the page - return page.parse() - - // Write as json - .then(function() { - var json = { - gitbook: { - version: gitbook.version - }, - path: page.path, - sections: page.content - }; - - return that.output.writeFile( - page.withExtension('.json'), - JSON.stringify(json, null, 4) - ); - }); -}; - -// At the end of generation, generate README.json for multilingual books -JSONGenerator.prototype.finish = function() { - if (!this.book.isMultilingual()) return; - - // Copy README.json from main book - var mainLanguage = this.book.langs.getDefault().id; - return this.output.copyFile( - this.output.resolve(mainLanguage, 'README.json'), - 'README.json' - ); -}; - - -module.exports = JSONGenerator; |