« get me outta code hell

content, css: generatePageLayout: wallpaper parts - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-06 19:43:05 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-06 19:43:58 -0400
commit1c4a398258ee6dc6fb41944574f3d6095c0a3f2a (patch)
tree90fd04598518057ba94816d332ea5dae2c7a53f8 /src/content
parentbda250f99566d08fadb4b24b32d30760e5758b2b (diff)
content, css: generatePageLayout: wallpaper parts
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/generatePageLayout.js16
1 files changed, 15 insertions, 1 deletions
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'},