From df93623c48f9ce32fe7fac8344512836f7fe345b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 27 Jul 2023 12:58:56 -0300 Subject: content: generateListingPage: listStyle slot (un/ordered) --- src/content/dependencies/generateListingPage.js | 14 ++++++++++++-- 1 file 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))))), -- cgit 1.3.0-6-gf8a5