« get me outta code hell

content: cut html.template boilerplate - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateTrackList.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-12 16:35:38 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-12 16:35:38 -0300
commit535acb34613b5cf7e22654619f4337b94b70644d (patch)
tree5a713eb4f12eae7e1fe1aa60941709708585db32 /src/content/dependencies/generateTrackList.js
parent630af0a345f3be6c3e4aa3300ce138e48ed5ae91 (diff)
content: cut html.template boilerplate
Diffstat (limited to 'src/content/dependencies/generateTrackList.js')
-rw-r--r--src/content/dependencies/generateTrackList.js50
1 files changed, 22 insertions, 28 deletions
diff --git a/src/content/dependencies/generateTrackList.js b/src/content/dependencies/generateTrackList.js
index e2e9f48d..6688a33d 100644
--- a/src/content/dependencies/generateTrackList.js
+++ b/src/content/dependencies/generateTrackList.js
@@ -22,34 +22,28 @@ export default {
     };
   },
 
-  generate(relations, {html, language}) {
-    return html.template({
-      annotation: `generateTrackList`,
-
-      slots: {
-        showContribution: {type: 'boolean', default: false},
-        showIcons: {type: 'boolean', default: false},
-      },
+  slots: {
+    showContribution: {type: 'boolean', default: false},
+    showIcons: {type: 'boolean', default: false},
+  },
 
-      content(slots) {
-        return html.tag('ul',
-          relations.items.map(({trackLink, contributionLinks}) =>
-            html.tag('li',
-              language.$('trackList.item.withArtists', {
-                track: trackLink,
-                by:
-                  html.tag('span', {class: 'by'},
-                    language.$('trackList.item.withArtists.by', {
-                      artists:
-                        language.formatConjunctionList(
-                          contributionLinks.map(link =>
-                            link.slots({
-                              showContribution: slots.showContribution,
-                              showIcons: slots.showIcons,
-                            }))),
-                    })),
-              }))));
-      },
-    });
+  generate(relations, slots, {html, language}) {
+    return html.tag('ul',
+      relations.items.map(({trackLink, contributionLinks}) =>
+        html.tag('li',
+          language.$('trackList.item.withArtists', {
+            track: trackLink,
+            by:
+              html.tag('span', {class: 'by'},
+                language.$('trackList.item.withArtists.by', {
+                  artists:
+                    language.formatConjunctionList(
+                      contributionLinks.map(link =>
+                        link.slots({
+                          showContribution: slots.showContribution,
+                          showIcons: slots.showIcons,
+                        }))),
+                })),
+          }))));
   },
 };