mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
24 lines
574 B
JavaScript
24 lines
574 B
JavaScript
var encodeOutput = require('./encodeOutput');
|
|
var encodePage = require('./encodePage');
|
|
var encodeFile = require('./encodeFile');
|
|
|
|
/**
|
|
* Return a JSON representation of a book with a specific file
|
|
*
|
|
* @param {Book} output
|
|
* @param {Page} page
|
|
* @return {Object}
|
|
*/
|
|
function encodeOutputWithPage(output, page) {
|
|
var file = page.getFile();
|
|
var book = output.getBook();
|
|
|
|
var result = encodeOutput(output);
|
|
result.page = encodePage(page, book.getSummary());
|
|
result.file = encodeFile(file);
|
|
|
|
return result;
|
|
}
|
|
|
|
module.exports = encodeOutputWithPage;
|