From 535acb34613b5cf7e22654619f4337b94b70644d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 12 Jun 2023 16:35:38 -0300 Subject: content: cut html.template boilerplate --- src/content/dependencies/generateTrackList.js | 50 ++++++++++++--------------- 1 file changed, 22 insertions(+), 28 deletions(-) (limited to 'src/content/dependencies/generateTrackList.js') 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, + }))), + })), + })))); }, }; -- cgit 1.3.0-6-gf8a5