More progress on parser.

This commit is contained in:
Joshua Bemenderfer
2023-02-12 09:00:19 -05:00
parent bc2fc78c96
commit 4e10b07561
9 changed files with 93 additions and 31 deletions

View File

@@ -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()))
}
}