From d0a398d51bf9bb63a53aa356425fa6b8a46202f2 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 26 May 2023 13:28:53 -0300 Subject: content: generateAlbumSidebarGroupBox: transform group description --- .../dependencies/generateAlbumSidebarGroupBox.js | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/content/dependencies') diff --git a/src/content/dependencies/generateAlbumSidebarGroupBox.js b/src/content/dependencies/generateAlbumSidebarGroupBox.js index 0679e8fc..1c27af9e 100644 --- a/src/content/dependencies/generateAlbumSidebarGroupBox.js +++ b/src/content/dependencies/generateAlbumSidebarGroupBox.js @@ -1,8 +1,14 @@ import {empty} from '../../util/sugar.js'; export default { - contentDependencies: ['linkAlbum', 'linkExternal', 'linkGroup'], - extraDependencies: ['html', 'language', 'transformMultiline'], + contentDependencies: [ + 'linkAlbum', + 'linkExternal', + 'linkGroup', + 'transformContent', + ], + + extraDependencies: ['html', 'language'], relations(relation, album, group) { const relations = {}; @@ -19,6 +25,11 @@ export default { const previousAlbum = (index > 0) && albums[index - 1]; const nextAlbum = (index < albums.length - 1) && albums[index + 1]; + if (group.descriptionShort) { + relations.description = + relation('transformContent', group.descriptionShort); + } + if (previousAlbum) { relations.previousAlbumLink = relation('linkAlbum', previousAlbum); @@ -32,13 +43,7 @@ export default { return relations; }, - data(album, group) { - return { - description: group.descriptionShort, - }; - }, - - generate(data, relations, {html, language, transformMultiline}) { + generate(relations, {html, language}) { return html.template({ annotation: `generateAlbumSidebarGroupBox`, @@ -54,7 +59,8 @@ export default { })), slots.isAlbumPage && - transformMultiline(data.description), + relations.description + ?.slot('mode', 'multiline'), !empty(relations.externalLinks) && html.tag('p', -- cgit 1.3.0-6-gf8a5