summaryrefslogtreecommitdiffstats
path: root/lib/output/json.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-04-30 20:15:08 +0200
committerSamy Pesse <samypesse@gmail.com>2016-04-30 20:15:08 +0200
commit36b49c66c6b75515bc84dd678fd52121a313e8d2 (patch)
treebc7e0f703d4557869943ec7f9495cac7a5027d4f /lib/output/json.js
parent87db7cf1d412fa6fbd18e9a7e4f4755f2c0c5547 (diff)
parent80b8e340dadc54377ff40500f86b1de631395806 (diff)
downloadgitbook-36b49c66c6b75515bc84dd678fd52121a313e8d2.zip
gitbook-36b49c66c6b75515bc84dd678fd52121a313e8d2.tar.gz
gitbook-36b49c66c6b75515bc84dd678fd52121a313e8d2.tar.bz2
Merge branch 'fixes'
Diffstat (limited to 'lib/output/json.js')
-rw-r--r--lib/output/json.js47
1 files changed, 0 insertions, 47 deletions
diff --git a/lib/output/json.js b/lib/output/json.js
deleted file mode 100644
index 7061141..0000000
--- a/lib/output/json.js
+++ /dev/null
@@ -1,47 +0,0 @@
-var conrefsLoader = require('./conrefs');
-
-var JSONOutput = conrefsLoader();
-
-JSONOutput.prototype.name = 'json';
-
-// Don't copy asset on JSON output
-JSONOutput.prototype.onAsset = function(filename) {};
-
-// Write a page (parsable file)
-JSONOutput.prototype.onPage = function(page) {
- var that = this;
-
- // Parse the page
- return page.toHTML(this)
-
- // Write as json
- .then(function() {
- var json = page.getOutputContext(that);
-
- // Delete some private properties
- delete json.config;
-
- // Specify JSON output version
- json.version = '3';
-
- return that.writeFile(
- page.withExtension('.json'),
- JSON.stringify(json, null, 4)
- );
- });
-};
-
-// At the end of generation, generate README.json for multilingual books
-JSONOutput.prototype.finish = function() {
- if (!this.book.isMultilingual()) return;
-
- // Copy README.json from main book
- var mainLanguage = this.book.langs.getDefault().id;
- return this.copyFile(
- this.resolve(mainLanguage, 'README.json'),
- 'README.json'
- );
-};
-
-
-module.exports = JSONOutput;