From 1c4a398258ee6dc6fb41944574f3d6095c0a3f2a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 6 Jan 2025 19:43:05 -0400 Subject: content, css: generatePageLayout: wallpaper parts --- src/content/dependencies/generatePageLayout.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/content/dependencies') diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js index a895fe9a..fa2cdc18 100644 --- a/src/content/dependencies/generatePageLayout.js +++ b/src/content/dependencies/generatePageLayout.js @@ -1,5 +1,5 @@ import {openAggregate} from '#aggregate'; -import {empty} from '#sugar'; +import {empty, repeat} from '#sugar'; export default { contentDependencies: [ @@ -578,6 +578,18 @@ export default { ])), ])); + const numWallpaperParts = + html.resolve(slots.styleRules, {normalize: 'string'}) + .match(/\.wallpaper-part:nth-child/g) + ?.length ?? 0; + + const wallpaperPartsHTML = + html.tag('div', {class: 'wallpaper-parts'}, + {[html.onlyIfContent]: true}, + + repeat(numWallpaperParts, () => + html.tag('div', {class: 'wallpaper-part'}))); + const layoutHTML = [ navHTML, @@ -734,6 +746,8 @@ export default { html.tag('body', [ + wallpaperPartsHTML, + html.tag('div', {id: 'page-container'}, showingSidebarLeft && {class: 'showing-sidebar-left'}, -- cgit 1.3.0-6-gf8a5