From 47769d85efbab949aeabc85155d8efff0a62485c Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 31 Jan 2023 09:04:09 -0400 Subject: increase page-template guarding resilience --- src/write/page-template.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/write/page-template.js b/src/write/page-template.js index 617c009f..de369018 100644 --- a/src/write/page-template.js +++ b/src/write/page-template.js @@ -86,9 +86,10 @@ export function generateDocumentHTML(pageInfo, { socialEmbed = {}, } = pageInfo; + body ||= {}; body.style ??= ''; - theme = theme || getThemeString(wikiInfo.color); + theme ||= getThemeString(wikiInfo.color); banner ||= {}; banner.classes ??= []; @@ -96,16 +97,18 @@ export function generateDocumentHTML(pageInfo, { banner.position ??= ''; banner.dimensions ??= [0, 0]; + main ||= {}; main.classes ??= []; main.content ??= ''; main.headingMode ??= 'none'; + cover ||= {}; cover.src ??= ''; cover.alt ??= ''; cover.artTags ??= []; - sidebarLeft ??= {}; - sidebarRight ??= {}; + sidebarLeft ||= {}; + sidebarRight ||= {}; for (const sidebar of [sidebarLeft, sidebarRight]) { sidebar.classes ??= []; @@ -113,21 +116,25 @@ export function generateDocumentHTML(pageInfo, { sidebar.collapse ??= true; } + nav ||= {}; nav.classes ??= []; nav.content ??= ''; nav.bottomRowContent ??= ''; nav.links ??= []; nav.linkContainerClasses ??= []; - secondaryNav ??= {}; + secondaryNav ||= {}; secondaryNav.content ??= ''; secondaryNav.content ??= ''; + footer ||= {}; footer.classes ??= []; footer.content ??= wikiInfo.footerContent ? transformMultiline(wikiInfo.footerContent) : ''; + socialEmbed ||= {}; + const colors = themeColor ? getColors(themeColor, {chroma}) : null; -- cgit 1.3.0-6-gf8a5