« get me outta code hell

content: generateListingPage: listStyle slot (un/ordered) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-07-27 12:58:56 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-07-27 12:58:56 -0300
commitdf93623c48f9ce32fe7fac8344512836f7fe345b (patch)
tree32fbb9f0c1e33674b4e852a15785146b29bb08de /src/content/dependencies
parent377a9804116e8931e6335a0e0f1025b06d15cf69 (diff)
content: generateListingPage: listStyle slot (un/ordered)
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateListingPage.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/content/dependencies/generateListingPage.js b/src/content/dependencies/generateListingPage.js
index c01d3b35..af93954e 100644
--- a/src/content/dependencies/generateListingPage.js
+++ b/src/content/dependencies/generateListingPage.js
@@ -65,10 +65,20 @@ export default {
     chunkTitles: {validate: v => v.strictArrayOf(v.isObject)},
     chunkRows: {validate: v => v.strictArrayOf(v.isObject)},
 
+    listStyle: {
+      validate: v => v.is('ordered', 'unordered'),
+      default: 'unordered',
+    },
+
     content: {type: 'html'},
   },
 
   generate(data, relations, slots, {html, language}) {
+    const listTag =
+      (slots.listStyle === 'ordered'
+        ? 'ol'
+        : 'ul');
+
     return relations.layout.slots({
       title: language.$(`listingPage.${data.stringsKey}.title`),
       headingMode: 'sticky',
@@ -99,7 +109,7 @@ export default {
             })),
 
         slots.type === 'rows' &&
-          html.tag('ul',
+          html.tag(listTag,
             slots.rows.map(row =>
               html.tag('li',
                 language.$(`listingPage.${data.stringsKey}.item`, row)))),
@@ -119,7 +129,7 @@ export default {
                   }),
 
                 html.tag('dd',
-                  html.tag('ul',
+                  html.tag(listTag,
                     rows.map(row =>
                       html.tag('li',
                         language.$(`listingPage.${data.stringsKey}.chunk.item`, row))))),