diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-01-31 09:04:09 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-01-31 09:04:09 -0400 |
commit | 47769d85efbab949aeabc85155d8efff0a62485c (patch) | |
tree | 6985bb4d3565d5996005b0ed452c07eb58049ae7 /src/write | |
parent | e8b0f56ca5846f3dc52b64794e95c73182219e94 (diff) |
increase page-template guarding resilience
Diffstat (limited to 'src/write')
-rw-r--r-- | src/write/page-template.js | 15 |
1 files 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; |