« get me outta code hell

content: encapsulate everything - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateAlbumTrackList.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-14 22:10:12 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-18 22:56:12 -0300
commit99261a74b1f3298144d8c5c6d676d63ad27a1299 (patch)
tree953c14b248dbc1ead549d717369c6d6155d11f19 /src/content/dependencies/generateAlbumTrackList.js
parent53b65bd2cbfb1001194d67f57780e92c6c8c5aaf (diff)
content: encapsulate everything
Diffstat (limited to 'src/content/dependencies/generateAlbumTrackList.js')
-rw-r--r--src/content/dependencies/generateAlbumTrackList.js41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/content/dependencies/generateAlbumTrackList.js b/src/content/dependencies/generateAlbumTrackList.js
index dd3e85e3..a3435bea 100644
--- a/src/content/dependencies/generateAlbumTrackList.js
+++ b/src/content/dependencies/generateAlbumTrackList.js
@@ -147,27 +147,30 @@ export default {
               durationApproximate,
               startIndex,
             }) => [
-              heading.slots({
-                tag: 'dt',
-
-                title:
-                  (duration === 0
-                    ? language.$('trackList.section', {
-                        section: name,
-                      })
-                    : language.$('trackList.section.withDuration', {
-                        section: name,
-                        duration:
+              language.encapsulate('trackList.section', capsule =>
+                heading.slots({
+                  tag: 'dt',
+
+                  title:
+                    language.encapsulate(capsule, capsule => {
+                      const options = {section: name};
+
+                      if (duration !== 0) {
+                        capsule += '.withDuration';
+                        options.duration =
                           language.formatDuration(duration, {
                             approximate: durationApproximate,
-                          }),
-                      })),
-
-                stickyTitle:
-                  language.$('trackList.section.sticky', {
-                    section: name,
-                  }),
-              }),
+                          });
+                      }
+
+                      return language.$(capsule, options);
+                    }),
+
+                  stickyTitle:
+                    language.$(capsule, 'sticky', {
+                      section: name,
+                    }),
+                })),
 
               html.tag('dd',
                 html.tag(listTag,