diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-01-31 23:01:14 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-01-31 23:03:12 -0400 |
| commit | 180d3e169b10db5f1837567eca9bf1b2d5542b96 (patch) | |
| tree | 80ac792949c3d9c40f5f748c4e5513450b702532 /src/content | |
| parent | e4faa8a4cbc08621a95413047370b2bda25bb3cb (diff) | |
content, data: MusicVideo.contributorStyle
Diffstat (limited to 'src/content')
| -rw-r--r-- | src/content/dependencies/generateMusicVideo.js | 20 | ||||
| -rw-r--r-- | src/content/dependencies/generateMusicVideoContributors.js | 57 |
2 files changed, 61 insertions, 16 deletions
diff --git a/src/content/dependencies/generateMusicVideo.js b/src/content/dependencies/generateMusicVideo.js index b62c0224..1eb33e0b 100644 --- a/src/content/dependencies/generateMusicVideo.js +++ b/src/content/dependencies/generateMusicVideo.js @@ -13,6 +13,9 @@ export default { dateLine: relation('generateMusicVideoDateLine', musicVideo, thing), + musicVideoContributors: + relation('generateMusicVideoContributors', musicVideo), + contributorCredit: relation('generateArtistCredit', musicVideo.contributorContribs, []), }), @@ -65,21 +68,6 @@ export default { relations.dateLine, ]), - html.tag('p', - language.encapsulate(capsule, 'contributorsLine', capsule => - language.$(capsule, { - [language.onlyIfOptions]: ['credit'], - - credit: - relations.contributorCredit.slots({ - normalStringKey: language.encapsulate(capsule, 'credit'), - - showAnnotation: true, - showChronology: true, - chunkwrap: false, - - chronologyKind: 'musicVideoContribution', - }), - }))), + relations.musicVideoContributors, ])), }; diff --git a/src/content/dependencies/generateMusicVideoContributors.js b/src/content/dependencies/generateMusicVideoContributors.js new file mode 100644 index 00000000..055df5cc --- /dev/null +++ b/src/content/dependencies/generateMusicVideoContributors.js @@ -0,0 +1,57 @@ +const contributionSlots = { + showAnnotation: true, + showChronology: true, + chronologyKind: 'musicVideoContribution', +}; + +export default { + relations: (relation, musicVideo) => ({ + artistCredit: + relation('generateArtistCredit', musicVideo.contributorContribs, []), + + contributionLinks: + musicVideo.contributorContribs + .map(contrib => relation('linkContribution', contrib)), + }), + + data: (musicVideo) => ({ + style: + musicVideo.contributorStyle, + }), + + generate: (data, relations, {html, language}) => + language.encapsulate('misc.musicVideo', capsule => + (data.style === 'list' + ? html.tag('p', + {[html.joinChildren]: html.tag('br')}, + {[html.onlyIfContent]: true}, + + [ + html.tags([ + language.$(capsule, 'contributorsList.title'), + ], {[html.onlyIfSiblings]: true}), + + relations.contributionLinks + .map(link => link.slots({...contributionSlots})), + ]) + + : data.style === 'line' + ? html.tag('p', + {[html.onlyIfContent]: true}, + + language.$(capsule, 'contributorsLine', { + [language.onlyIfOptions]: ['credit'], + + credit: + relations.artistCredit.slots({ + normalStringKey: + language.encapsulate(capsule, 'contributorsLine.credit'), + + chunkwrap: false, + + ...contributionSlots, + }), + })) + + : html.blank())), +}; |