From ae9dba60c4bbb327b402c500cc042922a954de74 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 28 Nov 2022 20:25:47 -0400 Subject: chronology tweaks & html.onlyIfContent bugfix --- src/misc-templates.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/misc-templates.js') 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 `
${language.$('misc.chronology.seeArtistPages')}
`; + 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 -- cgit 1.3.0-6-gf8a5