Start working on docs site.

This commit is contained in:
Joshua Bemenderfer
2023-02-11 22:30:10 -05:00
parent cb09652f61
commit bc2fc78c96
37 changed files with 1747 additions and 3087 deletions

31
docs/parser/page.js Normal file
View File

@@ -0,0 +1,31 @@
const parseSection = require('./section.js')
module.exports = async function(doc) {
const { next, line, match, tail, level, head } = doc
const pageData = {
title: '',
description: [],
layout: '',
sections: []
}
while(await next()) {
if (!line()) continue
if (match('title')) pageData.title = tail()
else if (match('layout')) pageData.layout = tail()
else if (match('description')) {
const l = level()
while(await next(l)) {
pageData.description.push(line(l))
}
}
else if (match('section')) {
pageData.sections.push(await parseSection(doc, level()))
}
}
console.dir(pageData, { depth: null })
return pageData
}