diff options
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`] = ` <p> - By <a href="artist/toby-fox/">Toby Fox</a> (music probably) and <a href="artist/tensei/">Tensei</a> (hot jams) (<span class="icons"><a href="https://tenseimusic.bandcamp.com/" class="icon"> - <svg> - <title>Bandcamp</title> - <use href="static/icons.svg#icon-bandcamp"></use> - </svg> - </a></span>). + By <span class="nowrap"><a href="artist/toby-fox/">Toby Fox</a> (music probably)</span> and <span class="nowrap"><a href="artist/tensei/">Tensei</a> (hot jams) (<span class="icons"><a href="https://tenseimusic.bandcamp.com/" class="icon"> + <svg> + <title>Bandcamp</title> + <use href="static/icons.svg#icon-bandcamp"></use> + </svg> + </a></span>)</span>. <br> Cover art by <a href="artist/hb/">Hanni Brosh</a>. <br> - Wallpaper art by <a href="artist/hb/">Hanni Brosh</a> and <a href="artist/niklink/">Niklink</a> (edits). + Wallpaper art by <a href="artist/hb/">Hanni Brosh</a> and <span class="nowrap"><a href="artist/niklink/">Niklink</a> (edits)</span>. <br> - Banner art by <a href="artist/hb/">Hanni Brosh</a> and <a href="artist/niklink/">Niklink</a> (edits). + Banner art by <a href="artist/hb/">Hanni Brosh</a> and <span class="nowrap"><a href="artist/niklink/">Niklink</a> (edits)</span>. <br> Released 3/14/2011. <br> 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 <p> By <a href="artist/toby-fox/">Toby Fox</a>. <br> - Cover art by <a href="artist/alpaca/">Alpaca</a> (🔥). + Cover art by <span class="nowrap"><a href="artist/alpaca/">Alpaca</a> (🔥)</span>. </p> <p>This wiki doesn't have any listening links for <i>Suspicious Track</i>.</p> ` 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`] = ` <a href="artist/clark-powell/">Clark Powell</a> -<a href="artist/the-big-baddies/">Grounder & Scratch</a> (Snooping) -<a href="artist/toby-fox/">Toby Fox</a> (Arrangement) +<span class="nowrap"><a href="artist/the-big-baddies/">Grounder & Scratch</a> (Snooping)</span> +<span class="nowrap"><a href="artist/toby-fox/">Toby Fox</a> (Arrangement)</span> ` exports[`test/snapshot/linkContribution.js TAP linkContribution (snapshot) > only showIcons 1`] = ` -<a href="artist/clark-powell/">Clark Powell</a> (<span class="icons"><a href="https://soundcloud.com/plazmataz" class="icon"> - <svg> - <title>SoundCloud</title> - <use href="static/icons.svg#icon-soundcloud"></use> - </svg> - </a></span>) +<span class="nowrap"><a href="artist/clark-powell/">Clark Powell</a> (<span class="icons"><a href="https://soundcloud.com/plazmataz" class="icon"> + <svg> + <title>SoundCloud</title> + <use href="static/icons.svg#icon-soundcloud"></use> + </svg> + </a></span>)</span> <a href="artist/the-big-baddies/">Grounder & Scratch</a> -<a href="artist/toby-fox/">Toby Fox</a> (<span class="icons"><a href="https://tobyfox.bandcamp.com/" class="icon"> - <svg> - <title>Bandcamp</title> - <use href="static/icons.svg#icon-bandcamp"></use> - </svg> - </a>, <a href="https://toby.fox/" class="icon"> - <svg> - <title>External (toby.fox)</title> - <use href="static/icons.svg#icon-globe"></use> - </svg> - </a></span>) +<span class="nowrap"><a href="artist/toby-fox/">Toby Fox</a> (<span class="icons"><a href="https://tobyfox.bandcamp.com/" class="icon"> + <svg> + <title>Bandcamp</title> + <use href="static/icons.svg#icon-bandcamp"></use> + </svg> + </a>, <a href="https://toby.fox/" class="icon"> + <svg> + <title>External (toby.fox)</title> + <use href="static/icons.svg#icon-globe"></use> + </svg> + </a></span>)</span> ` exports[`test/snapshot/linkContribution.js TAP linkContribution (snapshot) > showContribution & showIcons 1`] = ` -<a href="artist/clark-powell/">Clark Powell</a> (<span class="icons"><a href="https://soundcloud.com/plazmataz" class="icon"> - <svg> - <title>SoundCloud</title> - <use href="static/icons.svg#icon-soundcloud"></use> - </svg> - </a></span>) -<a href="artist/the-big-baddies/">Grounder & Scratch</a> (Snooping) -<a href="artist/toby-fox/">Toby Fox</a> (Arrangement) (<span class="icons"><a href="https://tobyfox.bandcamp.com/" class="icon"> - <svg> - <title>Bandcamp</title> - <use href="static/icons.svg#icon-bandcamp"></use> - </svg> - </a>, <a href="https://toby.fox/" class="icon"> - <svg> - <title>External (toby.fox)</title> - <use href="static/icons.svg#icon-globe"></use> - </svg> - </a></span>) +<span class="nowrap"><a href="artist/clark-powell/">Clark Powell</a> (<span class="icons"><a href="https://soundcloud.com/plazmataz" class="icon"> + <svg> + <title>SoundCloud</title> + <use href="static/icons.svg#icon-soundcloud"></use> + </svg> + </a></span>)</span> +<span class="nowrap"><a href="artist/the-big-baddies/">Grounder & Scratch</a> (Snooping)</span> +<span class="nowrap"><a href="artist/toby-fox/">Toby Fox</a> (Arrangement) (<span class="icons"><a href="https://tobyfox.bandcamp.com/" class="icon"> + <svg> + <title>Bandcamp</title> + <use href="static/icons.svg#icon-bandcamp"></use> + </svg> + </a>, <a href="https://toby.fox/" class="icon"> + <svg> + <title>External (toby.fox)</title> + <use href="static/icons.svg#icon-globe"></use> + </svg> + </a></span>)</span> ` |