« get me outta code hell

content: generateAlbumSidebarGroupBox: transform group description - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-05-26 13:28:53 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-05-26 13:28:53 -0300
commitd0a398d51bf9bb63a53aa356425fa6b8a46202f2 (patch)
tree3607cb2b5b9214e1973bc2a232c616ba3d07ed61 /src
parent686e8f462e24c486f057d4001507354a1d2f1848 (diff)
content: generateAlbumSidebarGroupBox: transform group description
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateAlbumSidebarGroupBox.js26
1 files changed, 16 insertions, 10 deletions
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',