diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-04-28 14:42:07 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-04-28 14:42:07 +0200 |
commit | f3058598dce590479d1f80ffbf486333e79fd5a7 (patch) | |
tree | b0af50dede7102c7de6b502aecd7a7e2814daccd | |
parent | 94db0f6ec9e2487a77572fd70931cf10a4dff54a (diff) | |
download | gitbook-f3058598dce590479d1f80ffbf486333e79fd5a7.zip gitbook-f3058598dce590479d1f80ffbf486333e79fd5a7.tar.gz gitbook-f3058598dce590479d1f80ffbf486333e79fd5a7.tar.bz2 |
Always generate a README.json as introduction of json output
-rw-r--r-- | lib/output/json/onPage.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/output/json/onPage.js b/lib/output/json/onPage.js index c2ee0d0..fece540 100644 --- a/lib/output/json/onPage.js +++ b/lib/output/json/onPage.js @@ -14,6 +14,7 @@ var JSON_VERSION = '3'; */ function onPage(output, page) { var file = page.getFile(); + var readme = output.getBook().getReadme().getFile(); return Modifiers.modifyHTML(page, getModifiers(output, page)) .then(function(resultPage) { @@ -27,7 +28,8 @@ function onPage(output, page) { json.version = JSON_VERSION; // File path in the output folder - var filePath = PathUtils.setExtension(file.getPath(), '.json'); + var filePath = file.getPath() == readme.getPath()? 'README.json' : file.getPath(); + filePath = PathUtils.setExtension(filePath, '.json'); // Write it to the disk return writeFile( |