summaryrefslogtreecommitdiffstats
path: root/lib/api/decodePage.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-04-27 10:38:54 +0200
committerSamy Pessé <samypesse@gmail.com>2016-04-27 10:38:54 +0200
commitb05eb8440b59db6d39ae06712ddda5651786e00a (patch)
tree1354043c55fccf0e114ec84307c23afa59ff340d /lib/api/decodePage.js
parentf4de7748f596a060e9a59df0447315b59d7c47de (diff)
downloadgitbook-b05eb8440b59db6d39ae06712ddda5651786e00a.zip
gitbook-b05eb8440b59db6d39ae06712ddda5651786e00a.tar.gz
gitbook-b05eb8440b59db6d39ae06712ddda5651786e00a.tar.bz2
Don;t log deprecation warning for own logic
Diffstat (limited to 'lib/api/decodePage.js')
-rw-r--r--lib/api/decodePage.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/api/decodePage.js b/lib/api/decodePage.js
index e0b7d1e..c85dd1b 100644
--- a/lib/api/decodePage.js
+++ b/lib/api/decodePage.js
@@ -1,3 +1,4 @@
+var deprecate = require('./deprecate');
/**
Decode changes from a JS API to a page object.
@@ -17,22 +18,26 @@ function decodePage(output, page, result) {
return page;
}
+ deprecate.disable('page.sections');
+
// GitBook 3
// Use returned page.content if different from original content
if (result.content != originalContent) {
- return page.set('content', result.content);
+ page = page.set('content', result.content);
}
// GitBook 2 compatibility
// Finally, use page.sections
- if (result.sections) {
- return page.set('content',
+ else if (result.sections) {
+ page = page.set('content',
result.sections.map(function(section) {
return section.content;
}).join('\n')
);
}
+ deprecate.enable('page.sections');
+
return page;
}