1
0
mirror of synced 2025-12-23 11:54:18 -05:00

make script/dev-toc/generate work like the olden days (#32481)

This commit is contained in:
Peter Bengtsson
2022-11-10 14:35:43 +01:00
committed by GitHub
parent 5630162802
commit 91c8cf973c

View File

@@ -36,6 +36,16 @@ async function main() {
const res = {} const res = {}
const req = { language: 'en', cookies: {} } const req = { language: 'en', cookies: {} }
async function recurse(tree) {
const { page } = tree
tree.renderedFullTitle = page.rawTitle.includes('{')
? await await liquid.parseAndRender(page.rawTitle, req.context)
: page.rawTitle
for (const node of tree.childPages || []) {
await recurse(node)
}
}
for (const version of allVersionKeys) { for (const version of allVersionKeys) {
req.pagePath = version === fpt ? '/' : `/${version}` req.pagePath = version === fpt ? '/' : `/${version}`
@@ -52,6 +62,8 @@ async function main() {
// Add the tree to the req.context. // Add the tree to the req.context.
req.context.currentEnglishTree = req.context.siteTree.en[req.context.currentVersion] req.context.currentEnglishTree = req.context.siteTree.en[req.context.currentVersion]
await recurse(req.context.currentEnglishTree)
// Add any defaultOpenSections to the context. // Add any defaultOpenSections to the context.
req.context.defaultOpenSections = defaultOpenSections req.context.defaultOpenSections = defaultOpenSections