summaryrefslogtreecommitdiffstats
path: root/lib/parse/parsePage.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/parse/parsePage.js')
-rw-r--r--lib/parse/parsePage.js24
1 files changed, 8 insertions, 16 deletions
diff --git a/lib/parse/parsePage.js b/lib/parse/parsePage.js
index 1d515d6..fdc56a3 100644
--- a/lib/parse/parsePage.js
+++ b/lib/parse/parsePage.js
@@ -1,27 +1,19 @@
-var Immutable = require('immutable');
-var fm = require('front-matter');
-var direction = require('direction');
+var parsePageFromString = require('./parsePageFromString');
/**
- Parse a page, read its content and parse the YAMl header
-
- @param {Book} book
- @param {Page} page
- @return {Promise<Page>}
-*/
+ * 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) {
- var parsed = fm(content);
-
- return page.merge({
- content: parsed.body,
- attributes: Immutable.fromJS(parsed.attributes),
- dir: direction(parsed.body)
- });
+ return parsePageFromString(page, content);
});
}