mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 05:48:57 +00:00
ca70c934d6
Add tests for parsePageFromString
22 lines
466 B
JavaScript
22 lines
466 B
JavaScript
var parsePageFromString = require('./parsePageFromString');
|
|
|
|
/**
|
|
* Parse a page, read its content and parse the YAMl header
|
|
*
|
|
* @param {Book} book
|
|
* @param {Page} page
|
|
* @return {Promise<Page>}
|
|
*/
|
|
function parsePage(book, page) {
|
|
var fs = book.getContentFS();
|
|
var file = page.getFile();
|
|
|
|
return fs.readAsString(file.getPath())
|
|
.then(function(content) {
|
|
return parsePageFromString(page, content);
|
|
});
|
|
}
|
|
|
|
|
|
module.exports = parsePage;
|