« get me outta code hell

chronology tweaks & html.onlyIfContent bugfix - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/misc-templates.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-11-28 20:25:47 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-11-28 20:25:47 -0400
commitae9dba60c4bbb327b402c500cc042922a954de74 (patch)
tree81084937a13778104c29976e027e83a17c51f5fb /src/misc-templates.js
parent5206ac7188c9eefd6f1d18050e2831b0f10be8ef (diff)
chronology tweaks & html.onlyIfContent bugfix
Diffstat (limited to 'src/misc-templates.js')
-rw-r--r--src/misc-templates.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 2275269..0a33648 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -154,19 +154,20 @@ function unbound_generateChronologyLinks(currentThing, {
   headingString,
 }) {
   const contributions = currentThing[contribKey];
-  if (!contributions) {
-    return '';
+
+  if (empty(contributions)) {
+    return [];
   }
 
   if (contributions.length > 8) {
-    return `<div class="chronology">${language.$('misc.chronology.seeArtistPages')}</div>`;
+    return html.tag('div', {class: 'chronology'},
+      language.$('misc.chronology.seeArtistPages'));
   }
 
   return contributions
     .map(({who: artist}) => {
-      const thingsUnsorted = unique(getThings(artist)).filter(
-        (t) => t[dateKey]
-      );
+      const thingsUnsorted = unique(getThings(artist))
+        .filter((t) => t[dateKey]);
 
       // Kinda a hack, but we automatically detect which is (probably) the
       // right function to use here.
@@ -208,10 +209,7 @@ function unbound_generateChronologyLinks(currentThing, {
                 navigation,
               })
             : heading)));
-    })
-    // TODO: use html.fragment when calling and get rid of these lines
-    .filter(Boolean)
-    .join('\n');
+    });
 }
 
 // Content warning tags