First work on actual site contents.

This commit is contained in:
Joshua Bemenderfer
2023-02-12 16:52:47 -05:00
parent 4e10b07561
commit 95842b73bd
20 changed files with 181 additions and 24 deletions

View File

@@ -6,8 +6,7 @@ module.exports.contentAsText = async function(doc, rootLevel) {
let contentDepth = -1
while(await next(rootLevel)) {
if (!line()) continue
if (contentDepth === -1) contentDepth = level()
if (contentDepth === -1 && !!line()) contentDepth = level()
const indent = ''.padStart(level() - contentDepth, ' ')
linesAsArray.push(indent + line())

View File

@@ -5,7 +5,7 @@ const languages = ['terrace', 'json', 'yaml', 'toml', 'javascript', 'typescript'
module.exports = async (doc, rootLevel) => {
const { next, level, line, head, tail } = doc
const codeExample = {
type: 'code-example',
type: 'CodeExample',
languages: {}
}

View File

@@ -3,7 +3,7 @@ const marked = require('marked')
module.exports = async (...args) => {
return {
type: `markdown`,
type: `Markdown`,
text: marked.parse(await contentAsText(...args))
}
}

View File

@@ -1,7 +1,7 @@
const parseNode = require('./node.js')
const parseNode = require('./Node.js')
module.exports.section = parseNode
module.exports.div = parseNode
module.exports.logo = doc => ({ type: `logo` })
module.exports.markdown = require('./markdown.js')
module.exports['code-example'] = require('./code-example.js')
module.exports.Section = parseNode
module.exports.Div = parseNode
module.exports.Logo = doc => ({ type: `Logo` })
module.exports.Markdown = require('./Markdown.js')
module.exports.CodeExample = require('./CodeExample.js')

View File

@@ -4,7 +4,7 @@ module.exports = async function(doc) {
const { next, line, match, tail, level, head } = doc
const pageData = {
type: `page`,
type: `Page`,
title: '',
description: [],
layout: '',
@@ -21,8 +21,8 @@ module.exports = async function(doc) {
pageData.description.push(line(l))
}
}
else if (match('section')) {
pageData.children.push(await knownNodes.section(doc, level()))
else if (match('Section')) {
pageData.children.push(await knownNodes.Section(doc, level()))
}
}