From e85c7b765c106006d45befcefa23789c3c57484c Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 15 Jun 2023 17:15:06 -0300 Subject: content: linkContribution: use nowrap when accents present --- src/content/dependencies/linkContribution.js | 41 ++++++------ .../snapshot/generateAlbumReleaseInfo.js.test.cjs | 16 ++--- .../snapshot/generateTrackReleaseInfo.js.test.cjs | 2 +- .../test/snapshot/linkContribution.js.test.cjs | 74 +++++++++++----------- 4 files changed, 67 insertions(+), 66 deletions(-) diff --git a/src/content/dependencies/linkContribution.js b/src/content/dependencies/linkContribution.js index cc0cb353..210d5b01 100644 --- a/src/content/dependencies/linkContribution.js +++ b/src/content/dependencies/linkContribution.js @@ -41,25 +41,26 @@ export default { {[html.noEdgeWhitespace]: true, class: 'icons'}, language.formatUnitList(relations.artistIcons)); + const parts = ['misc.artistLink']; + const options = {artist: relations.artistLink}; + + if (hasContributionPart) { + parts.push('withContribution'); + options.contrib = data.contribution; + } + + if (hasExternalPart) { + parts.push('withExternalLinks'); + options.links = externalLinks; + } + + const content = language.formatString(parts.join('.'), options); + return ( - (hasContributionPart - ? (hasExternalPart - ? language.$('misc.artistLink.withContribution.withExternalLinks', { - artist: relations.artistLink, - contrib: data.contribution, - links: externalLinks, - }) - : language.$('misc.artistLink.withContribution', { - artist: relations.artistLink, - contrib: data.contribution, - })) - : (hasExternalPart - ? language.$('misc.artistLink.withExternalLinks', { - artist: relations.artistLink, - links: externalLinks, - }) - : language.$('misc.artistLink', { - artist: relations.artistLink, - })))); - }, + (parts.length > 1 + ? html.tag('span', + {[html.noEdgeWhitespace]: true, class: 'nowrap'}, + content) + : content)); + }, }; diff --git a/tap-snapshots/test/snapshot/generateAlbumReleaseInfo.js.test.cjs b/tap-snapshots/test/snapshot/generateAlbumReleaseInfo.js.test.cjs index 769018a9..e769026f 100644 --- a/tap-snapshots/test/snapshot/generateAlbumReleaseInfo.js.test.cjs +++ b/tap-snapshots/test/snapshot/generateAlbumReleaseInfo.js.test.cjs @@ -11,18 +11,18 @@ exports[`test/snapshot/generateAlbumReleaseInfo.js TAP generateAlbumReleaseInfo exports[`test/snapshot/generateAlbumReleaseInfo.js TAP generateAlbumReleaseInfo (snapshot) > basic behavior 1`] = `

- By Toby Fox (music probably) and Tensei (hot jams) ( - - Bandcamp - - - ). + By Toby Fox (music probably) and Tensei (hot jams) ( + + Bandcamp + + + ).
Cover art by Hanni Brosh.
- Wallpaper art by Hanni Brosh and Niklink (edits). + Wallpaper art by Hanni Brosh and Niklink (edits).
- Banner art by Hanni Brosh and Niklink (edits). + Banner art by Hanni Brosh and Niklink (edits).
Released 3/14/2011.
diff --git a/tap-snapshots/test/snapshot/generateTrackReleaseInfo.js.test.cjs b/tap-snapshots/test/snapshot/generateTrackReleaseInfo.js.test.cjs index a5f9e971..e94ed822 100644 --- a/tap-snapshots/test/snapshot/generateTrackReleaseInfo.js.test.cjs +++ b/tap-snapshots/test/snapshot/generateTrackReleaseInfo.js.test.cjs @@ -25,7 +25,7 @@ exports[`test/snapshot/generateTrackReleaseInfo.js TAP generateTrackReleaseInfo

By Toby Fox.
- Cover art by Alpaca (🔥). + Cover art by Alpaca (🔥).

This wiki doesn't have any listening links for Suspicious Track.

` diff --git a/tap-snapshots/test/snapshot/linkContribution.js.test.cjs b/tap-snapshots/test/snapshot/linkContribution.js.test.cjs index cecad538..9ae75091 100644 --- a/tap-snapshots/test/snapshot/linkContribution.js.test.cjs +++ b/tap-snapshots/test/snapshot/linkContribution.js.test.cjs @@ -13,48 +13,48 @@ exports[`test/snapshot/linkContribution.js TAP linkContribution (snapshot) > no exports[`test/snapshot/linkContribution.js TAP linkContribution (snapshot) > only showContribution 1`] = ` Clark Powell -Grounder & Scratch (Snooping) -Toby Fox (Arrangement) +Grounder & Scratch (Snooping) +Toby Fox (Arrangement) ` exports[`test/snapshot/linkContribution.js TAP linkContribution (snapshot) > only showIcons 1`] = ` -Clark Powell ( - - SoundCloud - - - ) +Clark Powell ( + + SoundCloud + + + ) Grounder & Scratch -Toby Fox ( - - Bandcamp - - - , - - External (toby.fox) - - - ) +Toby Fox ( + + Bandcamp + + + , + + External (toby.fox) + + + ) ` exports[`test/snapshot/linkContribution.js TAP linkContribution (snapshot) > showContribution & showIcons 1`] = ` -Clark Powell ( - - SoundCloud - - - ) -Grounder & Scratch (Snooping) -Toby Fox (Arrangement) ( - - Bandcamp - - - , - - External (toby.fox) - - - ) +Clark Powell ( + + SoundCloud + + + ) +Grounder & Scratch (Snooping) +Toby Fox (Arrangement) ( + + Bandcamp + + + , + + External (toby.fox) + + + ) ` -- cgit 1.3.0-6-gf8a5