From f10f5a187f26d08019e452e7fbd417b7f462faa4 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 8 Jun 2026 12:08:36 -0300 Subject: content, data: Track: Contributor Text missing chronology link substitution --- .../dependencies/generateContributionList.js | 63 +++++++++++++++------- src/content/dependencies/generateFlashInfoPage.js | 15 ++---- src/content/dependencies/generateTrackInfoPage.js | 18 +++---- src/content/dependencies/transformContent.js | 13 ++++- 4 files changed, 68 insertions(+), 41 deletions(-) (limited to 'src/content') diff --git a/src/content/dependencies/generateContributionList.js b/src/content/dependencies/generateContributionList.js index 4f68321f..4796cc02 100644 --- a/src/content/dependencies/generateContributionList.js +++ b/src/content/dependencies/generateContributionList.js @@ -1,30 +1,55 @@ export default { - relations: (relation, contributions) => ({ + relations: (relation, contributions, formatText) => ({ contributionLinks: contributions .map(contrib => relation('linkContribution', contrib)), + + formatText: + relation('transformContent', formatText), }), slots: { + attributes: {type: 'attributes', mutable: false}, + title: {type: 'html', mutable: false}, + chronologyKind: {type: 'string'}, }, - generate: (relations, slots, {html, language}) => - html.tag('ul', - {[html.onlyIfContent]: true}, - - relations.contributionLinks.length > 1 && - language.$order('misc.artistLink.withContribution', 0) === 'ARTIST' && - {class: 'offset-tooltips'}, - - relations.contributionLinks - .map(contributionLink => - html.tag('li', - contributionLink.slots({ - showAnnotation: true, - showExternalLinks: true, - showChronology: true, - preventWrapping: false, - chronologyKind: slots.chronologyKind, - })))), + generate(relations, slots, {html, language}) { + const {contributionLinks} = relations; + + for (const link of contributionLinks) { + link.setSlots({ + showAnnotation: true, + showExternalLinks: true, + showChronology: true, + preventWrapping: false, + chronologyKind: slots.chronologyKind, + }); + } + + if (!html.isBlank(relations.formatText)) { + return ( + html.tag('div', + slots.attributes, + relations.formatText.slot('mode', 'contributors')) + ); + } + + return html.tags([ + html.tag('p', + slots.attributes, + slots.title), + + html.tag('ul', + {[html.onlyIfContent]: true}, + + relations.contributionLinks.length > 1 && + language.$order('misc.artistLink.withContribution', 0) === 'ARTIST' && + {class: 'offset-tooltips'}, + + contributionLinks + .map(link => html.tag('li', link))) + ]); + } }; diff --git a/src/content/dependencies/generateFlashInfoPage.js b/src/content/dependencies/generateFlashInfoPage.js index 9f18f19a..ad464bd7 100644 --- a/src/content/dependencies/generateFlashInfoPage.js +++ b/src/content/dependencies/generateFlashInfoPage.js @@ -163,17 +163,12 @@ export default { relations.featuredTracksList, ]), - html.tags([ - relations.contentHeading.clone() - .slots({ - attributes: {id: 'contributors'}, - title: language.$('releaseInfo.contributors'), - }), + relations.contributorContributionList.slots({ + attributes: {id: 'contributors'}, + title: language.$('releaseInfo.contributors'), - relations.contributorContributionList.slots({ - chronologyKind: 'flash', - }), - ]), + chronologyKind: 'flash', + }), html.tags([ relations.commentaryContentHeading, diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js index ac96e072..3d06b364 100644 --- a/src/content/dependencies/generateTrackInfoPage.js +++ b/src/content/dependencies/generateTrackInfoPage.js @@ -92,7 +92,9 @@ export default { relation('generateTrackInfoPageOtherReleasesLines', track), contributorContributionList: - relation('generateContributionList', track.contributorContribs), + relation('generateContributionList', + track.contributorContribs, + track.contributorText), referencedTracksList: relation('generateReferencedTracksList', track), @@ -264,16 +266,12 @@ export default { {[html.joinChildren]: html.tag('br')}, relations.otherReleasesLines), - html.tags([ - relations.contentHeading.clone().slots({ - attributes: {id: 'contributors'}, - title: language.$('releaseInfo.contributors'), - }), + relations.contributorContributionList.slots({ + attributes: {id: 'contributors'}, + title: language.$('releaseInfo.contributors'), - relations.contributorContributionList.slots({ - chronologyKind: 'trackContribution', - }), - ]), + chronologyKind: 'trackContribution', + }), html.tags([ relations.relationsContentHeading.clone().slots({ diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js index 243ab502..ad7530fe 100644 --- a/src/content/dependencies/transformContent.js +++ b/src/content/dependencies/transformContent.js @@ -302,7 +302,14 @@ export default { slots: { mode: { - validate: v => v.is('inline', 'multiline', 'lyrics', 'single-link'), + validate: v => v.is(...[ + 'inline', + 'multiline', + 'lyrics', + 'contributors', + 'single-link', + ]), + default: 'multiline', }, @@ -932,8 +939,10 @@ export default { // differently. Instead of having each line get its own paragraph, // "adjacent" lines are joined together (with blank lines separating // each verse/paragraph). + // + // Also this formatting goes for contributors mode too. - if (slots.mode === 'lyrics') { + if (slots.mode === 'lyrics' || slots.mode === 'contributors') { // If it looks like old data, using
instead of bunched together // lines... then oh god... just use transformMultiline. Perishes. if ( -- cgit 1.3.0-6-gf8a5