From 276700414846030fdd6f66be5dca99e8ee805119 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 20 Jun 2024 17:31:30 -0300 Subject: content: "featuring" credits --- .../dependencies/generateAlbumTrackListItem.js | 32 ++++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/content/dependencies/generateAlbumTrackListItem.js') diff --git a/src/content/dependencies/generateAlbumTrackListItem.js b/src/content/dependencies/generateAlbumTrackListItem.js index 7d5d2c6e..851bf32e 100644 --- a/src/content/dependencies/generateAlbumTrackListItem.js +++ b/src/content/dependencies/generateAlbumTrackListItem.js @@ -3,7 +3,7 @@ import {compareArrays, empty} from '#sugar'; export default { contentDependencies: [ 'generateAlbumTrackListMissingDuration', - 'linkContribution', + 'generateArtistCredit', 'linkTrack', ], @@ -31,11 +31,10 @@ export default { relations(relation, query, track) { const relations = {}; - if (!empty(track.artistContribs)) { - relations.contributionLinks = - track.artistContribs - .map(contrib => relation('linkContribution', contrib)); - } + relations.credit = + relation('generateArtistCredit', + track.artistContribs, + track.album.artistContribs); relations.trackLink = relation('linkTrack', track); @@ -113,16 +112,25 @@ export default { : relations.missingDuration); } - if (data.showArtists) { + const artistCapsule = language.encapsulate(itemCapsule, 'withArtists'); + + relations.credit.setSlots({ + normalStringKey: + artistCapsule + '.by', + + featuringStringKey: + artistCapsule + '.featuring', + + normalFeaturingStringKey: + artistCapsule + '.by.featuring', + }); + + if (!html.isBlank(relations.credit)) { workingCapsule += '.withArtists'; workingOptions.by = html.tag('span', {class: 'by'}, html.metatag('chunkwrap', {split: ','}, - html.resolve( - language.$(itemCapsule, 'withArtists.by', { - artists: - language.formatConjunctionList(relations.contributionLinks), - })))); + html.resolve(relations.credit))); } return language.$(workingCapsule, workingOptions); -- cgit 1.3.0-6-gf8a5