More progress on parser.
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
const parseSection = require('./section.js')
|
||||
const knownNodes = require('./nodes/index.js')
|
||||
|
||||
module.exports = async function(doc) {
|
||||
const { next, line, match, tail, level, head } = doc
|
||||
|
||||
const pageData = {
|
||||
type: `page`,
|
||||
title: '',
|
||||
description: [],
|
||||
layout: '',
|
||||
sections: []
|
||||
children: []
|
||||
}
|
||||
|
||||
while(await next()) {
|
||||
@@ -21,7 +22,7 @@ module.exports = async function(doc) {
|
||||
}
|
||||
}
|
||||
else if (match('section')) {
|
||||
pageData.sections.push(await parseSection(doc, level()))
|
||||
pageData.children.push(await knownNodes.section(doc, level()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user