summaryrefslogtreecommitdiffstats
path: root/lib/parse/parsePage.js
blob: fdc56a3bfb76fec4776a8900a1aed723785dc1b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;