Don;t log deprecation warning for own logic

This commit is contained in:
Samy Pessé
2016-04-27 10:38:54 +02:00
parent f4de7748f5
commit b05eb8440b
4 changed files with 38 additions and 7 deletions
+8 -3
View File
@@ -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;
}