28 lines
506 B
JavaScript
28 lines
506 B
JavaScript
const parseSection = require('./section.js')
|
|
|
|
const knownBlocks = {
|
|
'logo': () => {},
|
|
'div': () => {},
|
|
'markdown': () => {},
|
|
}
|
|
|
|
module.exports = async function(doc, rootLevel) {
|
|
const { next, line, match, tail, level, head } = doc
|
|
|
|
const section = {
|
|
class: '',
|
|
children: []
|
|
}
|
|
|
|
while (await next(rootLevel)) {
|
|
if (!head()) continue
|
|
const block = head()
|
|
if (!knownBlocks[block]) continue
|
|
|
|
// TODO: Start Parsing
|
|
section.children.push(line())
|
|
}
|
|
|
|
return section
|
|
}
|