summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/output/json/onPage.js4
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(