From c75b029160248b6935e5c0f5156cc7a870311e82 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 26 Jun 2022 18:02:27 -0300 Subject: real pragma, and some eslint fixes --- src/page/album-commentary.js | 87 +++++++-------- src/page/album.js | 223 ++++++++++++++++++------------------- src/page/artist-alias.js | 16 +-- src/page/artist.js | 258 +++++++++++++++++++++---------------------- src/page/flash.js | 160 +++++++++++++-------------- src/page/group.js | 128 ++++++++++----------- src/page/homepage.js | 70 ++++++------ src/page/index.js | 28 ++--- src/page/listing.js | 104 ++++++++--------- src/page/news.js | 60 +++++----- src/page/static.js | 18 +-- src/page/tag.js | 46 ++++---- src/page/track.js | 157 +++++++++++++------------- 13 files changed, 669 insertions(+), 686 deletions(-) (limited to 'src/page') diff --git a/src/page/album-commentary.js b/src/page/album-commentary.js index b469838d..719bd65a 100644 --- a/src/page/album-commentary.js +++ b/src/page/album-commentary.js @@ -1,34 +1,34 @@ -// @format -// +/** @format */ + // Album commentary page and index specifications. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; -import { filterAlbumsByCommentary } from "../util/wiki-data.js"; +import {filterAlbumsByCommentary} from '../util/wiki-data.js'; // Page exports -export function condition({ wikiData }) { +export function condition({wikiData}) { return filterAlbumsByCommentary(wikiData.albumData).length; } -export function targets({ wikiData }) { +export function targets({wikiData}) { return filterAlbumsByCommentary(wikiData.albumData); } -export function write(album, { wikiData }) { - const { wikiInfo } = wikiData; +export function write(album, {wikiData}) { + const {wikiInfo} = wikiData; const entries = [album, ...album.tracks] .filter((x) => x.commentary) .map((x) => x.commentary); - const words = entries.join(" ").split(" ").length; + const words = entries.join(' ').split(' ').length; const page = { - type: "page", - path: ["albumCommentary", album.directory], + type: 'page', + path: ['albumCommentary', album.directory], page: ({ getAlbumStylesheet, getLinkThemeString, @@ -38,30 +38,30 @@ export function write(album, { wikiData }) { to, transformMultiline, }) => ({ - title: language.$("albumCommentaryPage.title", { album: album.name }), + title: language.$('albumCommentaryPage.title', {album: album.name}), stylesheet: getAlbumStylesheet(album), theme: getThemeString(album.color), main: { content: fixWS`
-

${language.$("albumCommentaryPage.title", { +

${language.$('albumCommentaryPage.title', { album: link.album(album), })}

-

${language.$("albumCommentaryPage.infoLine", { +

${language.$('albumCommentaryPage.infoLine', { words: `${language.formatWordCount(words, { unit: true, })}`, entries: `${language.countCommentaryEntries( entries.length, - { unit: true } + {unit: true} )}`, })}

${ album.commentary && fixWS`

${language.$( - "albumCommentaryPage.entry.title.albumCommentary" + 'albumCommentaryPage.entry.title.albumCommentary' )}

${transformMultiline(album.commentary)} @@ -73,7 +73,7 @@ export function write(album, { wikiData }) { .map( (track) => fixWS`

${language.$( - "albumCommentaryPage.entry.title.trackCommentary", + 'albumCommentaryPage.entry.title.trackCommentary', { track: link.track(track), } @@ -85,22 +85,22 @@ export function write(album, { wikiData }) {

` ) - .join("\n")} + .join('\n')}
`, }, nav: { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, { - path: ["localized.commentaryIndex"], - title: language.$("commentaryIndex.title"), + path: ['localized.commentaryIndex'], + title: language.$('commentaryIndex.title'), }, { - html: language.$("albumCommentaryPage.nav.album", { - album: link.albumCommentary(album, { class: "current" }), + html: language.$('albumCommentaryPage.nav.album', { + album: link.albumCommentary(album, {class: 'current'}), }), }, ], @@ -111,7 +111,7 @@ export function write(album, { wikiData }) { return [page]; } -export function writeTargetless({ wikiData }) { +export function writeTargetless({wikiData}) { const data = filterAlbumsByCommentary(wikiData.albumData) .map((album) => ({ album, @@ -119,44 +119,41 @@ export function writeTargetless({ wikiData }) { .filter((x) => x.commentary) .map((x) => x.commentary), })) - .map(({ album, entries }) => ({ + .map(({album, entries}) => ({ album, entries, - words: entries.join(" ").split(" ").length, + words: entries.join(' ').split(' ').length, })); - const totalEntries = data.reduce( - (acc, { entries }) => acc + entries.length, - 0 - ); - const totalWords = data.reduce((acc, { words }) => acc + words, 0); + const totalEntries = data.reduce((acc, {entries}) => acc + entries.length, 0); + const totalWords = data.reduce((acc, {words}) => acc + words, 0); const page = { - type: "page", - path: ["commentaryIndex"], - page: ({ link, language }) => ({ - title: language.$("commentaryIndex.title"), + type: 'page', + path: ['commentaryIndex'], + page: ({link, language}) => ({ + title: language.$('commentaryIndex.title'), main: { content: fixWS`
-

${language.$("commentaryIndex.title")}

-

${language.$("commentaryIndex.infoLine", { +

${language.$('commentaryIndex.title')}

+

${language.$('commentaryIndex.infoLine', { words: `${language.formatWordCount(totalWords, { unit: true, })}`, entries: `${language.countCommentaryEntries( totalEntries, - { unit: true } + {unit: true} )}`, })}

-

${language.$("commentaryIndex.albumList.title")}

+

${language.$('commentaryIndex.albumList.title')}

`, }, - nav: { simple: true }, + nav: {simple: true}, }), }; diff --git a/src/page/album.js b/src/page/album.js index f015976f..6c8bb844 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -1,33 +1,33 @@ -// @format -// +/** @format */ + // Album page specification. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; -import * as html from "../util/html.js"; +import * as html from '../util/html.js'; -import { bindOpts, compareArrays } from "../util/sugar.js"; +import {bindOpts, compareArrays} from '../util/sugar.js'; import { getAlbumCover, getAlbumListTag, getTotalDuration, -} from "../util/wiki-data.js"; +} from '../util/wiki-data.js'; // Page exports -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.albumData; } -export function write(album, { wikiData }) { - const { wikiInfo } = wikiData; +export function write(album, {wikiData}) { + const {wikiInfo} = wikiData; const unbound_trackToListItem = ( track, - { getArtistString, getLinkThemeString, link, language } + {getArtistString, getLinkThemeString, link, language} ) => { const itemOpts = { duration: language.formatDuration(track.duration ?? 0), @@ -37,13 +37,13 @@ export function write(album, { wikiData }) { compareArrays( track.artistContribs.map((c) => c.who), album.artistContribs.map((c) => c.who), - { checkOrder: false } + {checkOrder: false} ) - ? language.$("trackList.item.withDuration", itemOpts) - : language.$("trackList.item.withDuration.withArtists", { + ? language.$('trackList.item.withDuration', itemOpts) + : language.$('trackList.item.withDuration.withArtists', { ...itemOpts, by: `${language.$( - "trackList.item.withArtists.by", + 'trackList.item.withArtists.by', { artists: getArtistString(track.artistContribs), } @@ -60,8 +60,8 @@ export function write(album, { wikiData }) { const listTag = getAlbumListTag(album); const data = { - type: "data", - path: ["album", album.directory], + type: 'data', + path: ['album', album.directory], data: ({ serializeContribs, serializeCover, @@ -97,8 +97,8 @@ export function write(album, { wikiData }) { }; const page = { - type: "page", - path: ["album", album.directory], + type: 'page', + path: ['album', album.directory], page: ({ fancifyURL, generateAdditionalFilesShortcut, @@ -126,7 +126,7 @@ export function write(album, { wikiData }) { const cover = getAlbumCover(album); return { - title: language.$("albumPage.title", { album: album.name }), + title: language.$('albumPage.title', {album: album.name}), stylesheet: getAlbumStylesheet(album), theme: getThemeString(album.color, [ `--album-directory: ${album.directory}`, @@ -135,12 +135,12 @@ export function write(album, { wikiData }) { banner: album.bannerArtistContribs.length && { dimensions: album.bannerDimensions, path: [ - "media.albumBanner", + 'media.albumBanner', album.directory, album.bannerFileExtension, ], - alt: language.$("misc.alt.albumBanner"), - position: "top", + alt: language.$('misc.alt.albumBanner'), + position: 'top', }, main: { @@ -149,17 +149,17 @@ export function write(album, { wikiData }) { cover && generateCoverLink({ src: cover, - alt: language.$("misc.alt.albumCover"), + alt: language.$('misc.alt.albumCover'), tags: album.artTags, }) } -

${language.$("albumPage.title", { +

${language.$('albumPage.title', { album: album.name, })}

${[ album.artistContribs.length && - language.$("releaseInfo.by", { + language.$('releaseInfo.by', { artists: getArtistString( album.artistContribs, { @@ -169,7 +169,7 @@ export function write(album, { wikiData }) { ), }), album.coverArtistContribs.length && - language.$("releaseInfo.coverArtBy", { + language.$('releaseInfo.coverArtBy', { artists: getArtistString( album.coverArtistContribs, { @@ -179,7 +179,7 @@ export function write(album, { wikiData }) { ), }), album.wallpaperArtistContribs.length && - language.$("releaseInfo.wallpaperArtBy", { + language.$('releaseInfo.wallpaperArtBy', { artists: getArtistString( album.wallpaperArtistContribs, { @@ -189,7 +189,7 @@ export function write(album, { wikiData }) { ), }), album.bannerArtistContribs.length && - language.$("releaseInfo.bannerArtBy", { + language.$('releaseInfo.bannerArtBy', { artists: getArtistString( album.bannerArtistContribs, { @@ -199,23 +199,23 @@ export function write(album, { wikiData }) { ), }), album.date && - language.$("releaseInfo.released", { + language.$('releaseInfo.released', { date: language.formatDate(album.date), }), album.coverArtDate && +album.coverArtDate !== +album.date && - language.$("releaseInfo.artReleased", { + language.$('releaseInfo.artReleased', { date: language.formatDate(album.coverArtDate), }), - language.$("releaseInfo.duration", { + language.$('releaseInfo.duration', { duration: language.formatDuration( albumDuration, - { approximate: album.tracks.length > 1 } + {approximate: album.tracks.length > 1} ), }), ] .filter(Boolean) - .join("
\n")} + .join('
\n')}

${ (hasAdditionalFiles || hasCommentaryEntries) && @@ -224,26 +224,26 @@ export function write(album, { wikiData }) { hasAdditionalFiles && generateAdditionalFilesShortcut( album.additionalFiles, - { language } + {language} ), hasCommentaryEntries && - language.$("releaseInfo.viewCommentary", { + language.$('releaseInfo.viewCommentary', { link: link.albumCommentary(album, { text: language.$( - "releaseInfo.viewCommentary.link" + 'releaseInfo.viewCommentary.link' ), }), }), ] .filter(Boolean) - .join("
\n")}

` + .join('
\n')}

` } ${ album.urls?.length && - `

${language.$("releaseInfo.listenOn", { + `

${language.$('releaseInfo.listenOn', { links: language.formatDisjunctionList( album.urls.map((url) => - fancifyURL(url, { album: true }) + fancifyURL(url, {album: true}) ) ), })}

` @@ -263,32 +263,32 @@ export function write(album, { wikiData }) { tracks, }) => fixWS`
${language.$( - "trackList.section.withDuration", + 'trackList.section.withDuration', { duration: language.formatDuration( getTotalDuration(tracks), - { approximate: tracks.length > 1 } + {approximate: tracks.length > 1} ), section: name, } )}
<${ - listTag === "ol" + listTag === 'ol' ? `ol start="${startIndex + 1}"` : listTag }> ${tracks .map(trackToListItem) - .join("\n")} + .join('\n')}
` ) - .join("\n")} + .join('\n')} ` : fixWS` <${listTag}> - ${album.tracks.map(trackToListItem).join("\n")} + ${album.tracks.map(trackToListItem).join('\n')} ` } @@ -297,14 +297,14 @@ export function write(album, { wikiData }) { fixWS`

${[ - language.$("releaseInfo.addedToWiki", { + language.$('releaseInfo.addedToWiki', { date: language.formatDate( album.dateAddedToWiki ), }), ] .filter(Boolean) - .join("
\n")} + .join('
\n')}

` } @@ -315,21 +315,21 @@ export function write(album, { wikiData }) { getFileSize: (file) => getSizeOfAdditionalFile( urls - .from("media.root") + .from('media.root') .to( - "media.albumAdditionalFile", + 'media.albumAdditionalFile', album.directory, file ) ), linkFile: (file) => - link.albumAdditionalFile({ album, file }), + link.albumAdditionalFile({album, file}), }) } ${ album.commentary && fixWS` -

${language.$("releaseInfo.artistCommentary")}

+

${language.$('releaseInfo.artistCommentary')}

${transformMultiline(album.commentary)}
@@ -348,16 +348,16 @@ export function write(album, { wikiData }) { }), nav: { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, { - html: language.$("albumPage.nav.album", { - album: link.album(album, { class: "current" }), + html: language.$('albumPage.nav.album', { + album: link.album(album, {class: 'current'}), }), }, ], - bottomRowContent: generateAlbumNavLinks(album, null, { language }), + bottomRowContent: generateAlbumNavLinks(album, null, {language}), content: generateAlbumChronologyLinks(album, null, { generateChronologyLinks, }), @@ -380,14 +380,7 @@ export function write(album, { wikiData }) { export function generateAlbumSidebar( album, currentTrack, - { - fancifyURL, - getLinkThemeString, - link, - language, - transformMultiline, - wikiData, - } + {fancifyURL, getLinkThemeString, link, language, transformMultiline, wikiData} ) { const listTag = getAlbumListTag(album); @@ -400,41 +393,41 @@ export function generateAlbumSidebar( }]; */ - const { trackGroups } = album; + const {trackGroups} = album; const trackToListItem = (track) => html.tag( - "li", - { class: track === currentTrack && "current" }, - language.$("albumSidebar.trackList.item", { + 'li', + {class: track === currentTrack && 'current'}, + language.$('albumSidebar.trackList.item', { track: link.track(track), }) ); const nameOrDefault = (isDefaultTrackGroup, name) => isDefaultTrackGroup - ? language.$("albumSidebar.trackList.fallbackGroupName") + ? language.$('albumSidebar.trackList.fallbackGroupName') : name; const trackListPart = fixWS`

${link.album(album)}

${trackGroups - .map(({ name, color, startIndex, tracks, isDefaultTrackGroup }) => + .map(({name, color, startIndex, tracks, isDefaultTrackGroup}) => html.tag( - "details", + 'details', { // Leave side8ar track groups collapsed on al8um homepage, // since there's already a view of all the groups expanded // in the main content area. open: currentTrack && tracks.includes(currentTrack), - class: tracks.includes(currentTrack) && "current", + class: tracks.includes(currentTrack) && 'current', }, [ html.tag( - "summary", - { style: getLinkThemeString(color) }, - listTag === "ol" - ? language.$("albumSidebar.trackList.group.withRange", { + 'summary', + {style: getLinkThemeString(color)}, + listTag === 'ol' + ? language.$('albumSidebar.trackList.group.withRange', { group: `${nameOrDefault( isDefaultTrackGroup, name @@ -443,7 +436,7 @@ export function generateAlbumSidebar( startIndex + tracks.length }`, }) - : language.$("albumSidebar.trackList.group", { + : language.$('albumSidebar.trackList.group', { group: `${nameOrDefault( isDefaultTrackGroup, name @@ -452,20 +445,20 @@ export function generateAlbumSidebar( ), fixWS` <${ - listTag === "ol" + listTag === 'ol' ? `ol start="${startIndex + 1}"` : listTag }> - ${tracks.map(trackToListItem).join("\n")} + ${tracks.map(trackToListItem).join('\n')} `, ] ) ) - .join("\n")} + .join('\n')} `; - const { groups } = album; + const {groups} = album; const groupParts = groups .map((group) => { @@ -473,17 +466,17 @@ export function generateAlbumSidebar( const index = albums.indexOf(album); const next = index >= 0 && albums[index + 1]; const previous = index > 0 && albums[index - 1]; - return { group, next, previous }; + return {group, next, previous}; }) .map( - ({ group, next, previous }) => fixWS` -

${language.$("albumSidebar.groupBox.title", { + ({group, next, previous}) => fixWS` +

${language.$('albumSidebar.groupBox.title', { group: link.groupInfo(group), })}

${!currentTrack && transformMultiline(group.descriptionShort)} ${ group.urls?.length && - `

${language.$("releaseInfo.visitOn", { + `

${language.$('releaseInfo.visitOn', { links: language.formatDisjunctionList( group.urls.map((url) => fancifyURL(url)) ), @@ -495,7 +488,7 @@ export function generateAlbumSidebar( ${ next && `


\n"); + const combinedGroupPart = groupParts.join('\n
\n'); return { multiple: [trackListPart, combinedGroupPart], }; @@ -536,9 +529,9 @@ export function generateAlbumSidebar( export function generateAlbumSecondaryNav( album, currentTrack, - { link, language, getLinkThemeString } + {link, language, getLinkThemeString} ) { - const { groups } = album; + const {groups} = album; if (!groups.length) { return null; @@ -550,56 +543,56 @@ export function generateAlbumSecondaryNav( const index = albums.indexOf(album); const next = index >= 0 && albums[index + 1]; const previous = index > 0 && albums[index - 1]; - return { group, next, previous }; + return {group, next, previous}; }) - .map(({ group, next, previous }) => { + .map(({group, next, previous}) => { const previousNext = !currentTrack && [ previous && link.album(previous, { color: false, - text: language.$("misc.nav.previous"), + text: language.$('misc.nav.previous'), }), next && link.album(next, { color: false, - text: language.$("misc.nav.next"), + text: language.$('misc.nav.next'), }), ].filter(Boolean); - return html.tag("span", { style: getLinkThemeString(group.color) }, [ - language.$("albumSidebar.groupBox.title", { + return html.tag('span', {style: getLinkThemeString(group.color)}, [ + language.$('albumSidebar.groupBox.title', { group: link.groupInfo(group), }), - previousNext?.length && `(${previousNext.join(",\n")})`, + previousNext?.length && `(${previousNext.join(',\n')})`, ]); }); return { - classes: ["dot-between-spans"], - content: groupParts.join("\n"), + classes: ['dot-between-spans'], + content: groupParts.join('\n'), }; } export function generateAlbumNavLinks( album, currentTrack, - { generatePreviousNextLinks, language } + {generatePreviousNextLinks, language} ) { if (album.tracks.length <= 1) { - return ""; + return ''; } const previousNextLinks = currentTrack && generatePreviousNextLinks(currentTrack, { data: album.tracks, - linkKey: "track", + linkKey: 'track', }); const randomLink = `${ currentTrack - ? language.$("trackPage.nav.random") - : language.$("albumPage.nav.randomTrack") + ? language.$('trackPage.nav.random') + : language.$('albumPage.nav.randomTrack') }`; return previousNextLinks @@ -610,44 +603,44 @@ export function generateAlbumNavLinks( export function generateAlbumChronologyLinks( album, currentTrack, - { generateChronologyLinks } + {generateChronologyLinks} ) { return html.tag( - "div", + 'div', { [html.onlyIfContent]: true, - class: "nav-chronology-links", + class: 'nav-chronology-links', }, [ currentTrack && generateChronologyLinks(currentTrack, { - contribKey: "artistContribs", + contribKey: 'artistContribs', getThings: (artist) => [ ...artist.tracksAsArtist, ...artist.tracksAsContributor, ], - headingString: "misc.chronology.heading.track", + headingString: 'misc.chronology.heading.track', }), currentTrack && generateChronologyLinks(currentTrack, { - contribKey: "contributorContribs", + contribKey: 'contributorContribs', getThings: (artist) => [ ...artist.tracksAsArtist, ...artist.tracksAsContributor, ], - headingString: "misc.chronology.heading.track", + headingString: 'misc.chronology.heading.track', }), generateChronologyLinks(currentTrack || album, { - contribKey: "coverArtistContribs", - dateKey: "coverArtDate", + contribKey: 'coverArtistContribs', + dateKey: 'coverArtDate', getThings: (artist) => [ ...artist.albumsAsCoverArtist, ...artist.tracksAsCoverArtist, ], - headingString: "misc.chronology.heading.coverArt", + headingString: 'misc.chronology.heading.coverArt', }), ] .filter(Boolean) - .join("\n") + .join('\n') ); } diff --git a/src/page/artist-alias.js b/src/page/artist-alias.js index 8a45503d..46ad1a34 100644 --- a/src/page/artist-alias.js +++ b/src/page/artist-alias.js @@ -1,21 +1,21 @@ -// @format -// +/** @format */ + // Artist alias redirect pages. // (Makes old permalinks bring visitors to the up-to-date page.) -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.artistAliasData; } -export function write(aliasArtist, { wikiData }) { +export function write(aliasArtist, {wikiData}) { // This function doesn't actually use wikiData, 8ut, um, consistency? - const { aliasedArtist } = aliasArtist; + const {aliasedArtist} = aliasArtist; const redirect = { - type: "redirect", - fromPath: ["artist", aliasArtist.directory], - toPath: ["artist", aliasedArtist.directory], + type: 'redirect', + fromPath: ['artist', aliasArtist.directory], + toPath: ['artist', aliasedArtist.directory], title: () => aliasedArtist.name, }; diff --git a/src/page/artist.js b/src/page/artist.js index 314d2aa2..6b26b0f9 100644 --- a/src/page/artist.js +++ b/src/page/artist.js @@ -1,16 +1,16 @@ -// @format -// +/** @format */ + // Artist page specification. // // NB: See artist-alias.js for artist alias redirect pages. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; -import * as html from "../util/html.js"; +import * as html from '../util/html.js'; -import { bindOpts, unique } from "../util/sugar.js"; +import {bindOpts, unique} from '../util/sugar.js'; import { chunkByProperties, @@ -19,18 +19,18 @@ import { sortByDate, sortByDirectory, sortChronologically, -} from "../util/wiki-data.js"; +} from '../util/wiki-data.js'; // Page exports -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.artistData; } -export function write(artist, { wikiData }) { - const { groupData, wikiInfo } = wikiData; +export function write(artist, {wikiData}) { + const {groupData, wikiInfo} = wikiData; - const { name, urls, contextNotes } = artist; + const {name, urls, contextNotes} = artist; const artThingsAll = sortAlbumsTracksChronologically( unique([ @@ -39,7 +39,7 @@ export function write(artist, { wikiData }) { ...(artist.albumsAsBannerArtist ?? []), ...(artist.tracksAsCoverArtist ?? []), ]), - { getDate: (o) => o.coverArtDate } + {getDate: (o) => o.coverArtDate} ); const artThingsGallery = sortAlbumsTracksChronologically( @@ -47,7 +47,7 @@ export function write(artist, { wikiData }) { ...(artist.albumsAsCoverArtist ?? []), ...(artist.tracksAsCoverArtist ?? []), ], - { getDate: (o) => o.coverArtDate } + {getDate: (o) => o.coverArtDate} ); const commentaryThings = sortAlbumsTracksChronologically([ @@ -58,17 +58,17 @@ export function write(artist, { wikiData }) { const hasGallery = artThingsGallery.length > 0; const getArtistsAndContrib = (thing, key) => ({ - artists: thing[key]?.filter(({ who }) => who !== artist), - contrib: thing[key]?.find(({ who }) => who === artist), + artists: thing[key]?.filter(({who}) => who !== artist), + contrib: thing[key]?.find(({who}) => who === artist), thing, key, }); const artListChunks = chunkByProperties( artThingsAll.flatMap((thing) => - ["coverArtistContribs", "wallpaperArtistContribs", "bannerArtistContribs"] + ['coverArtistContribs', 'wallpaperArtistContribs', 'bannerArtistContribs'] .map((key) => getArtistsAndContrib(thing, key)) - .filter(({ contrib }) => contrib) + .filter(({contrib}) => contrib) .map((props) => ({ album: thing.album || thing, track: thing.album ? thing : null, @@ -76,7 +76,7 @@ export function write(artist, { wikiData }) { ...props, })) ), - ["date", "album"] + ['date', 'album'] ); const commentaryListChunks = chunkByProperties( @@ -84,7 +84,7 @@ export function write(artist, { wikiData }) { album: thing.album || thing, track: thing.album ? thing : null, })), - ["album"] + ['album'] ); const allTracks = sortAlbumsTracksChronologically( @@ -101,19 +101,19 @@ export function write(artist, { wikiData }) { date: +track.date, album: track.album, duration: track.duration, - artists: track.artistContribs.some(({ who }) => who === artist) - ? track.artistContribs.filter(({ who }) => who !== artist) - : track.contributorContribs.filter(({ who }) => who !== artist), + artists: track.artistContribs.some(({who}) => who === artist) + ? track.artistContribs.filter(({who}) => who !== artist) + : track.contributorContribs.filter(({who}) => who !== artist), contrib: { who: artist, whatArray: [ - track.artistContribs.find(({ who }) => who === artist)?.what, - track.contributorContribs.find(({ who }) => who === artist)?.what, + track.artistContribs.find(({who}) => who === artist)?.what, + track.contributorContribs.find(({who}) => who === artist)?.what, ].filter(Boolean), }, })), - ["date", "album"] - ).map(({ date, album, chunk }) => ({ + ['date', 'album'] + ).map(({date, album, chunk}) => ({ date, album, chunk, @@ -132,7 +132,7 @@ export function write(artist, { wikiData }) { group, contributions: usedGroups.filter((g) => g === group).length, })) - .filter(({ contributions }) => contributions > 0) + .filter(({contributions}) => contributions > 0) .sort((a, b) => b.contributions - a.contributions); }; @@ -151,10 +151,10 @@ export function write(artist, { wikiData }) { // want to show the full list of other contri8utors inline. // (It can often 8e very, very large!) artists: [], - contrib: flash.contributorContribs.find(({ who }) => who === artist), + contrib: flash.contributorContribs.find(({who}) => who === artist), })), - ["act"] - ).map(({ act, chunk }) => ({ + ['act'] + ).map(({act, chunk}) => ({ act, chunk, dateFirst: chunk[0].date, @@ -171,11 +171,11 @@ export function write(artist, { wikiData }) { contrib, }) => original - ? language.$("artistPage.creditList.entry.rerelease", { entry }) + ? language.$('artistPage.creditList.entry.rerelease', {entry}) : artists.length ? contrib.what || contrib.whatArray?.length ? language.$( - "artistPage.creditList.entry.withArtists.withContribution", + 'artistPage.creditList.entry.withArtists.withContribution', { entry, artists: getArtistString(artists), @@ -184,12 +184,12 @@ export function write(artist, { wikiData }) { : contrib.what, } ) - : language.$("artistPage.creditList.entry.withArtists", { + : language.$('artistPage.creditList.entry.withArtists', { entry, artists: getArtistString(artists), }) : contrib.what || contrib.whatArray?.length - ? language.$("artistPage.creditList.entry.withContribution", { + ? language.$('artistPage.creditList.entry.withContribution', { entry, contribution: contrib.whatArray ? language.formatUnitList(contrib.whatArray) @@ -199,16 +199,16 @@ export function write(artist, { wikiData }) { const unbound_generateTrackList = ( chunks, - { getArtistString, link, language } + {getArtistString, link, language} ) => fixWS`
${chunks .map( - ({ date, album, chunk, duration }) => fixWS` + ({date, album, chunk, duration}) => fixWS`
${ date && duration ? language.$( - "artistPage.creditList.album.withDate.withDuration", + 'artistPage.creditList.album.withDate.withDuration', { album: link.album(album), date: language.formatDate(date), @@ -218,27 +218,27 @@ export function write(artist, { wikiData }) { } ) : date - ? language.$("artistPage.creditList.album.withDate", { + ? language.$('artistPage.creditList.album.withDate', { album: link.album(album), date: language.formatDate(date), }) : duration - ? language.$("artistPage.creditList.album.withDuration", { + ? language.$('artistPage.creditList.album.withDuration', { album: link.album(album), duration: language.formatDuration(duration, { approximate: true, }), }) - : language.$("artistPage.creditList.album", { + : language.$('artistPage.creditList.album', { album: link.album(album), }) }
    ${chunk - .map(({ track, ...props }) => ({ + .map(({track, ...props}) => ({ original: track.originalReleaseTrack, entry: language.$( - "artistPage.creditList.entry.track.withDuration", + 'artistPage.creditList.entry.track.withDuration', { track: link.track(track), duration: language.formatDuration( @@ -248,10 +248,10 @@ export function write(artist, { wikiData }) { ), ...props, })) - .map(({ original, ...opts }) => + .map(({original, ...opts}) => html.tag( - "li", - { class: original && "rerelease" }, + 'li', + {class: original && 'rerelease'}, generateEntryAccents({ getArtistString, language, @@ -260,18 +260,18 @@ export function write(artist, { wikiData }) { }) ) ) - .join("\n")} + .join('\n')}
` ) - .join("\n")} + .join('\n')}
`; const unbound_serializeArtistsAndContrib = - (key, { serializeContribs, serializeLink }) => + (key, {serializeContribs, serializeLink}) => (thing) => { - const { artists, contrib } = getArtistsAndContrib(thing, key); + const {artists, contrib} = getArtistsAndContrib(thing, key); const ret = {}; ret.link = serializeLink(thing); if (contrib.what) ret.contribution = contrib.what; @@ -279,21 +279,21 @@ export function write(artist, { wikiData }) { return ret; }; - const unbound_serializeTrackListChunks = (chunks, { serializeLink }) => - chunks.map(({ date, album, chunk, duration }) => ({ + const unbound_serializeTrackListChunks = (chunks, {serializeLink}) => + chunks.map(({date, album, chunk, duration}) => ({ album: serializeLink(album), date, duration, - tracks: chunk.map(({ track }) => ({ + tracks: chunk.map(({track}) => ({ link: serializeLink(track), duration: track.duration, })), })); const data = { - type: "data", - path: ["artist", artist.directory], - data: ({ serializeContribs, serializeLink }) => { + type: 'data', + path: ['artist', artist.directory], + data: ({serializeContribs, serializeLink}) => { const serializeArtistsAndContrib = bindOpts( unbound_serializeArtistsAndContrib, { @@ -312,22 +312,22 @@ export function write(artist, { wikiData }) { return { albums: { asCoverArtist: artist.albumsAsCoverArtist?.map( - serializeArtistsAndContrib("coverArtistContribs") + serializeArtistsAndContrib('coverArtistContribs') ), asWallpaperArtist: artist.albumsAsWallpaperArtist?.map( - serializeArtistsAndContrib("wallpaperArtistContribs") + serializeArtistsAndContrib('wallpaperArtistContribs') ), asBannerArtist: artist.albumsAsBannerArtist?.map( - serializeArtistsAndContrib("bannerArtistContribs") + serializeArtistsAndContrib('bannerArtistContribs') ), }, flashes: wikiInfo.enableFlashesAndGames ? { asContributor: artist.flashesAsContributor ?.map((flash) => - getArtistsAndContrib(flash, "contributorContribs") + getArtistsAndContrib(flash, 'contributorContribs') ) - .map(({ contrib, thing: flash }) => ({ + .map(({contrib, thing: flash}) => ({ link: serializeLink(flash), contribution: contrib.what, })), @@ -335,10 +335,10 @@ export function write(artist, { wikiData }) { : null, tracks: { asArtist: artist.tracksAsArtist.map( - serializeArtistsAndContrib("artistContribs") + serializeArtistsAndContrib('artistContribs') ), asContributor: artist.tracksAsContributor.map( - serializeArtistsAndContrib("contributorContribs") + serializeArtistsAndContrib('contributorContribs') ), chunked: serializeTrackListChunks(trackListChunks), }, @@ -347,8 +347,8 @@ export function write(artist, { wikiData }) { }; const infoPage = { - type: "page", - path: ["artist", artist.directory], + type: 'page', + path: ['artist', artist.directory], page: ({ fancifyURL, generateCoverLink, @@ -367,7 +367,7 @@ export function write(artist, { wikiData }) { }); return { - title: language.$("artistPage.title", { artist: name }), + title: language.$('artistPage.title', {artist: name}), main: { content: fixWS` @@ -375,16 +375,16 @@ export function write(artist, { wikiData }) { artist.hasAvatar && generateCoverLink({ src: getArtistAvatar(artist), - alt: language.$("misc.alt.artistAvatar"), + alt: language.$('misc.alt.artistAvatar'), }) } -

${language.$("artistPage.title", { +

${language.$('artistPage.title', { artist: name, })}

${ contextNotes && fixWS` -

${language.$("releaseInfo.note")}

+

${language.$('releaseInfo.note')}

${transformMultiline(contextNotes)}
@@ -393,41 +393,41 @@ export function write(artist, { wikiData }) { } ${ urls?.length && - `

${language.$("releaseInfo.visitOn", { + `

${language.$('releaseInfo.visitOn', { links: language.formatDisjunctionList( - urls.map((url) => fancifyURL(url, { language })) + urls.map((url) => fancifyURL(url, {language})) ), })}

` } ${ hasGallery && - `

${language.$("artistPage.viewArtGallery", { + `

${language.$('artistPage.viewArtGallery', { link: link.artistGallery(artist, { text: language.$( - "artistPage.viewArtGallery.link" + 'artistPage.viewArtGallery.link' ), }), })}

` } -

${language.$("misc.jumpTo.withLinks", { +

${language.$('misc.jumpTo.withLinks', { links: language.formatUnitList( [ allTracks.length && `${language.$( - "artistPage.trackList.title" + 'artistPage.trackList.title' )}`, artThingsAll.length && `${language.$( - "artistPage.artList.title" + 'artistPage.artList.title' )}`, wikiInfo.enableFlashesAndGames && flashes.length && `${language.$( - "artistPage.flashList.title" + 'artistPage.flashList.title' )}`, commentaryThings.length && `${language.$( - "artistPage.commentaryList.title" + 'artistPage.commentaryList.title' )}`, ].filter(Boolean) ), @@ -436,22 +436,22 @@ export function write(artist, { wikiData }) { allTracks.length && fixWS`

${language.$( - "artistPage.trackList.title" + 'artistPage.trackList.title' )}

${language.$( - "artistPage.contributedDurationLine", + 'artistPage.contributedDurationLine', { artist: artist.name, duration: language.formatDuration( totalDuration, - { approximate: true, unit: true } + {approximate: true, unit: true} ), } )}

-

${language.$("artistPage.musicGroupsLine", { +

${language.$('artistPage.musicGroupsLine', { groups: language.formatUnitList( - musicGroups.map(({ group, contributions }) => - language.$("artistPage.groupsLine.item", { + musicGroups.map(({group, contributions}) => + language.$('artistPage.groupsLine.item', { group: link.groupInfo(group), contributions: language.countContributions( @@ -468,25 +468,25 @@ export function write(artist, { wikiData }) { artThingsAll.length && fixWS`

${language.$( - "artistPage.artList.title" + 'artistPage.artList.title' )}

${ hasGallery && `

${language.$( - "artistPage.viewArtGallery.orBrowseList", + 'artistPage.viewArtGallery.orBrowseList', { link: link.artistGallery(artist, { text: language.$( - "artistPage.viewArtGallery.link" + 'artistPage.viewArtGallery.link' ), }), } )}

` } -

${language.$("artistPage.artGroupsLine", { +

${language.$('artistPage.artGroupsLine', { groups: language.formatUnitList( - artGroups.map(({ group, contributions }) => - language.$("artistPage.groupsLine.item", { + artGroups.map(({group, contributions}) => + language.$('artistPage.groupsLine.item', { group: link.groupInfo(group), contributions: language.countContributions( @@ -499,9 +499,9 @@ export function write(artist, { wikiData }) {

${artListChunks .map( - ({ date, album, chunk }) => fixWS` + ({date, album, chunk}) => fixWS`
${language.$( - "artistPage.creditList.album.withDate", + 'artistPage.creditList.album.withDate', { album: link.album(album), date: language.formatDate(date), @@ -518,20 +518,20 @@ export function write(artist, { wikiData }) { }) => ({ entry: track ? language.$( - "artistPage.creditList.entry.track", + 'artistPage.creditList.entry.track', { track: link.track(track), } ) : `${language.$( - "artistPage.creditList.entry.album." + + 'artistPage.creditList.entry.album.' + { wallpaperArtistContribs: - "wallpaperArt", + 'wallpaperArt', bannerArtistContribs: - "bannerArt", + 'bannerArt', coverArtistContribs: - "coverArt", + 'coverArt', }[key] )}`, ...props, @@ -545,11 +545,11 @@ export function write(artist, { wikiData }) { }) ) .map((row) => `
  • ${row}
  • `) - .join("\n")} + .join('\n')} ` ) - .join("\n")} + .join('\n')}
    ` } @@ -558,7 +558,7 @@ export function write(artist, { wikiData }) { flashes.length && fixWS`

    ${language.$( - "artistPage.flashList.title" + 'artistPage.flashList.title' )}

    ${flashListChunks @@ -570,7 +570,7 @@ export function write(artist, { wikiData }) { dateLast, }) => fixWS`
    ${language.$( - "artistPage.creditList.flashAct.withDateRange", + 'artistPage.creditList.flashAct.withDateRange', { act: link.flash(chunk[0].flash, { text: act.name, @@ -583,9 +583,9 @@ export function write(artist, { wikiData }) { )}
      ${chunk - .map(({ flash, ...props }) => ({ + .map(({flash, ...props}) => ({ entry: language.$( - "artistPage.creditList.entry.flash", + 'artistPage.creditList.entry.flash', { flash: link.flash(flash), } @@ -600,11 +600,11 @@ export function write(artist, { wikiData }) { }) ) .map((row) => `
    • ${row}
    • `) - .join("\n")} + .join('\n')}
    ` ) - .join("\n")} + .join('\n')}
    ` } @@ -612,38 +612,38 @@ export function write(artist, { wikiData }) { commentaryThings.length && fixWS`

    ${language.$( - "artistPage.commentaryList.title" + 'artistPage.commentaryList.title' )}

    ${commentaryListChunks .map( - ({ album, chunk }) => fixWS` + ({album, chunk}) => fixWS`
    ${language.$( - "artistPage.creditList.album", + 'artistPage.creditList.album', { album: link.album(album), } )}
      ${chunk - .map(({ album, track, ...props }) => + .map(({album, track, ...props}) => track ? language.$( - "artistPage.creditList.entry.track", + 'artistPage.creditList.entry.track', { track: link.track(track), } ) : `${language.$( - "artistPage.creditList.entry.album.commentary" + 'artistPage.creditList.entry.album.commentary' )}` ) .map((row) => `
    • ${row}
    • `) - .join("\n")} + .join('\n')}
    ` ) - .join("\n")} + .join('\n')}
    ` } @@ -661,8 +661,8 @@ export function write(artist, { wikiData }) { }; const galleryPage = hasGallery && { - type: "page", - path: ["artistGallery", artist.directory], + type: 'page', + path: ['artistGallery', artist.directory], page: ({ generateInfoGalleryLinks, getAlbumCover, @@ -672,26 +672,26 @@ export function write(artist, { wikiData }) { language, to, }) => ({ - title: language.$("artistGalleryPage.title", { artist: name }), + title: language.$('artistGalleryPage.title', {artist: name}), main: { - classes: ["top-index"], + classes: ['top-index'], content: fixWS` -

    ${language.$("artistGalleryPage.title", { +

    ${language.$('artistGalleryPage.title', { artist: name, })}

    ${language.$( - "artistGalleryPage.infoLine", + 'artistGalleryPage.infoLine', { coverArts: language.countCoverArts( artThingsGallery.length, - { unit: true } + {unit: true} ), } )}

    ${getGridHTML({ - entries: artThingsGallery.map((item) => ({ item })), + entries: artThingsGallery.map((item) => ({item})), srcFn: (thing) => thing.album ? getTrackCover(thing) @@ -723,30 +723,30 @@ function generateNavForArtist( artist, isGallery, hasGallery, - { generateInfoGalleryLinks, link, language, wikiData } + {generateInfoGalleryLinks, link, language, wikiData} ) { - const { wikiInfo } = wikiData; + const {wikiInfo} = wikiData; const infoGalleryLinks = hasGallery && generateInfoGalleryLinks(artist, isGallery, { link, language, - linkKeyGallery: "artistGallery", - linkKeyInfo: "artist", + linkKeyGallery: 'artistGallery', + linkKeyInfo: 'artist', }); return { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, wikiInfo.enableListings && { - path: ["localized.listingIndex"], - title: language.$("listingIndex.title"), + path: ['localized.listingIndex'], + title: language.$('listingIndex.title'), }, { - html: language.$("artistPage.nav.artist", { - artist: link.artist(artist, { class: "current" }), + html: language.$('artistPage.nav.artist', { + artist: link.artist(artist, {class: 'current'}), }), }, hasGallery && { diff --git a/src/page/flash.js b/src/page/flash.js index 864f44de..340927d6 100644 --- a/src/page/flash.js +++ b/src/page/flash.js @@ -1,29 +1,29 @@ -// @format -// +/** @format */ + // Flash page and index specifications. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; -import * as html from "../util/html.js"; +import * as html from '../util/html.js'; -import { getFlashLink } from "../util/wiki-data.js"; +import {getFlashLink} from '../util/wiki-data.js'; // Page exports -export function condition({ wikiData }) { +export function condition({wikiData}) { return wikiData.wikiInfo.enableFlashesAndGames; } -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.flashData; } -export function write(flash, { wikiData }) { +export function write(flash, {wikiData}) { const page = { - type: "page", - path: ["flash", flash.directory], + type: 'page', + path: ['flash', flash.directory], page: ({ fancifyFlashURL, generateChronologyLinks, @@ -36,26 +36,26 @@ export function write(flash, { wikiData }) { language, transformInline, }) => ({ - title: language.$("flashPage.title", { flash: flash.name }), + title: language.$('flashPage.title', {flash: flash.name}), theme: getThemeString(flash.color, [ `--flash-directory: ${flash.directory}`, ]), main: { content: fixWS` -

    ${language.$("flashPage.title", { +

    ${language.$('flashPage.title', { flash: flash.name, })}

    ${generateCoverLink({ src: getFlashCover(flash), - alt: language.$("misc.alt.flashArt"), + alt: language.$('misc.alt.flashArt'), })} -

    ${language.$("releaseInfo.released", { +

    ${language.$('releaseInfo.released', { date: language.formatDate(flash.date), })}

    ${ (flash.page || flash.urls?.length) && - `

    ${language.$("releaseInfo.playOn", { + `

    ${language.$('releaseInfo.playOn', { links: language.formatDisjunctionList( [ flash.page && getFlashLink(flash), @@ -69,15 +69,15 @@ export function write(flash, { wikiData }) { fixWS`

    Tracks featured in ${flash.name.replace( /\.$/, - "" + '' )}:

      ${flash.featuredTracks .map((track) => - language.$("trackList.item.withArtists", { + language.$('trackList.item.withArtists', { track: link.track(track), by: `${language.$( - "trackList.item.withArtists.by", + 'trackList.item.withArtists.by', { artists: getArtistString( track.artistContribs @@ -87,14 +87,14 @@ export function write(flash, { wikiData }) { }) ) .map((row) => `
    • ${row}
    • `) - .join("\n")} + .join('\n')}
    ` } ${ flash.contributorContribs.length && fixWS` -

    ${language.$("releaseInfo.contributors")}

    +

    ${language.$('releaseInfo.contributors')}

      ${flash.contributorContribs .map( @@ -104,14 +104,14 @@ export function write(flash, { wikiData }) { showIcons: true, })}` ) - .join("\n")} + .join('\n')}
    ` } `, }, - sidebarLeft: generateSidebarForFlash(flash, { link, language, wikiData }), + sidebarLeft: generateSidebarForFlash(flash, {link, language, wikiData}), nav: generateNavForFlash(flash, { generateChronologyLinks, generatePreviousNextLinks, @@ -125,32 +125,32 @@ export function write(flash, { wikiData }) { return [page]; } -export function writeTargetless({ wikiData }) { - const { flashActData } = wikiData; +export function writeTargetless({wikiData}) { + const {flashActData} = wikiData; const page = { - type: "page", - path: ["flashIndex"], - page: ({ getFlashGridHTML, getLinkThemeString, link, language }) => ({ - title: language.$("flashIndex.title"), + type: 'page', + path: ['flashIndex'], + page: ({getFlashGridHTML, getLinkThemeString, link, language}) => ({ + title: language.$('flashIndex.title'), main: { - classes: ["flash-index"], + classes: ['flash-index'], content: fixWS` -

    ${language.$("flashIndex.title")}

    +

    ${language.$('flashIndex.title')}

    -

    ${language.$("misc.jumpTo")}

    +

    ${language.$('misc.jumpTo')}

      ${flashActData .filter((act) => act.jump) .map( - ({ anchor, jump, jumpColor }) => fixWS` + ({anchor, jump, jumpColor}) => fixWS`
    • ${jump}
    • ` ) - .join("\n")} + .join('\n')}
    ${flashActData @@ -171,11 +171,11 @@ export function writeTargetless({ wikiData }) {
    ` ) - .join("\n")} + .join('\n')} `, }, - nav: { simple: true }, + nav: {simple: true}, }), }; @@ -186,32 +186,26 @@ export function writeTargetless({ wikiData }) { function generateNavForFlash( flash, - { - generateChronologyLinks, - generatePreviousNextLinks, - link, - language, - wikiData, - } + {generateChronologyLinks, generatePreviousNextLinks, link, language, wikiData} ) { - const { flashData, wikiInfo } = wikiData; + const {flashData, wikiInfo} = wikiData; const previousNextLinks = generatePreviousNextLinks(flash, { data: flashData, - linkKey: "flash", + linkKey: 'flash', }); return { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, { - path: ["localized.flashIndex"], - title: language.$("flashIndex.title"), + path: ['localized.flashIndex'], + title: language.$('flashIndex.title'), }, { - html: language.$("flashPage.nav.flash", { - flash: link.flash(flash, { class: "current" }), + html: language.$('flashPage.nav.flash', { + flash: link.flash(flash, {class: 'current'}), }), }, ], @@ -221,8 +215,8 @@ function generateNavForFlash( content: fixWS`
    ${generateChronologyLinks(flash, { - headingString: "misc.chronology.heading.flash", - contribKey: "contributorContribs", + headingString: 'misc.chronology.heading.flash', + contribKey: 'contributorContribs', getThings: (artist) => artist.flashesAsContributor, })}
    @@ -230,21 +224,21 @@ function generateNavForFlash( }; } -function generateSidebarForFlash(flash, { link, language, wikiData }) { +function generateSidebarForFlash(flash, {link, language, wikiData}) { // all hard-coded, sorry :( // this doesnt have a super portable implementation/design...yet!! - const { flashActData } = wikiData; + const {flashActData} = wikiData; - const act6 = flashActData.findIndex((act) => act.name.startsWith("Act 6")); + const act6 = flashActData.findIndex((act) => act.name.startsWith('Act 6')); const postCanon = flashActData.findIndex((act) => - act.name.includes("Post Canon") + act.name.includes('Post Canon') ); const outsideCanon = postCanon + flashActData .slice(postCanon) - .findIndex((act) => !act.name.includes("Post Canon")); + .findIndex((act) => !act.name.includes('Post Canon')); const actIndex = flashActData.indexOf(flash.act); const side = actIndex < 0 ? 0 : actIndex < act6 ? 1 : actIndex <= outsideCanon ? 2 : 3; @@ -252,18 +246,18 @@ function generateSidebarForFlash(flash, { link, language, wikiData }) { return { content: fixWS` -

    ${link.flashIndex("", { - text: language.$("flashIndex.title"), +

    ${link.flashIndex('', { + text: language.$('flashIndex.title'), })}

    ${flashActData .filter( (act) => - act.name.startsWith("Act 1") || - act.name.startsWith("Act 6 Act 1") || - act.name.startsWith("Hiveswap") || + act.name.startsWith('Act 1') || + act.name.startsWith('Act 6 Act 1') || + act.name.startsWith('Hiveswap') || // Sorry not sorry -Yiffy - (({ index = flashActData.indexOf(act) } = {}) => + (({index = flashActData.indexOf(act)} = {}) => index < act6 ? side === 1 : index < outsideCanon @@ -271,43 +265,43 @@ function generateSidebarForFlash(flash, { link, language, wikiData }) { : true)() ) .flatMap((act) => [ - (act.name.startsWith("Act 1") && + (act.name.startsWith('Act 1') && html.tag( - "dt", - { class: ["side", side === 1 && "current"] }, + 'dt', + {class: ['side', side === 1 && 'current']}, link.flash(act.flashes[0], { - color: "#4ac925", + color: '#4ac925', text: `Side 1 (Acts 1-5)`, }) )) || - (act.name.startsWith("Act 6 Act 1") && + (act.name.startsWith('Act 6 Act 1') && html.tag( - "dt", - { class: ["side", side === 2 && "current"] }, + 'dt', + {class: ['side', side === 2 && 'current']}, link.flash(act.flashes[0], { - color: "#1076a2", + color: '#1076a2', text: `Side 2 (Acts 6-7)`, }) )) || - (act.name.startsWith("Hiveswap Act 1") && + (act.name.startsWith('Hiveswap Act 1') && html.tag( - "dt", - { class: ["side", side === 3 && "current"] }, + 'dt', + {class: ['side', side === 3 && 'current']}, link.flash(act.flashes[0], { - color: "#008282", + color: '#008282', text: `Outside Canon (Misc. Games)`, }) )), - (({ index = flashActData.indexOf(act) } = {}) => + (({index = flashActData.indexOf(act)} = {}) => index < act6 ? side === 1 : index < outsideCanon ? side === 2 : true)() && html.tag( - "dt", - { class: act === currentAct && "current" }, - link.flash(act.flashes[0], { text: act.name }) + 'dt', + {class: act === currentAct && 'current'}, + link.flash(act.flashes[0], {text: act.name}) ), act === currentAct && fixWS` @@ -315,17 +309,17 @@ function generateSidebarForFlash(flash, { link, language, wikiData }) { ${act.flashes .map((f) => html.tag( - "li", - { class: f === flash && "current" }, + 'li', + {class: f === flash && 'current'}, link.flash(f) ) ) - .join("\n")} + .join('\n')} `, ]) .filter(Boolean) - .join("\n")} + .join('\n')}
    `, }; diff --git a/src/page/group.js b/src/page/group.js index b6f99785..c7de2fbc 100644 --- a/src/page/group.js +++ b/src/page/group.js @@ -1,25 +1,25 @@ -// @format -// +/** @format */ + // Group page specifications. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; -import * as html from "../util/html.js"; +import * as html from '../util/html.js'; -import { getTotalDuration, sortChronologically } from "../util/wiki-data.js"; +import {getTotalDuration, sortChronologically} from '../util/wiki-data.js'; // Page exports -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.groupData; } -export function write(group, { wikiData }) { - const { listingSpec, wikiInfo } = wikiData; +export function write(group, {wikiData}) { + const {listingSpec, wikiInfo} = wikiData; - const { albums } = group; + const {albums} = group; const tracks = albums.flatMap((album) => album.tracks); const totalDuration = getTotalDuration(tracks); @@ -29,8 +29,8 @@ export function write(group, { wikiData }) { })); const infoPage = { - type: "page", - path: ["groupInfo", group.directory], + type: 'page', + path: ['groupInfo', group.directory], page: ({ generateInfoGalleryLinks, generatePreviousNextLinks, @@ -41,57 +41,57 @@ export function write(group, { wikiData }) { language, transformMultiline, }) => ({ - title: language.$("groupInfoPage.title", { group: group.name }), + title: language.$('groupInfoPage.title', {group: group.name}), theme: getThemeString(group.color), main: { content: fixWS` -

    ${language.$("groupInfoPage.title", { +

    ${language.$('groupInfoPage.title', { group: group.name, })}

    ${ group.urls?.length && - `

    ${language.$("releaseInfo.visitOn", { + `

    ${language.$('releaseInfo.visitOn', { links: language.formatDisjunctionList( - group.urls.map((url) => fancifyURL(url, { language })) + group.urls.map((url) => fancifyURL(url, {language})) ), })}

    ` }
    ${transformMultiline(group.description)}
    -

    ${language.$("groupInfoPage.albumList.title")}

    -

    ${language.$("groupInfoPage.viewAlbumGallery", { +

    ${language.$('groupInfoPage.albumList.title')}

    +

    ${language.$('groupInfoPage.viewAlbumGallery', { link: link.groupGallery(group, { - text: language.$("groupInfoPage.viewAlbumGallery.link"), + text: language.$('groupInfoPage.viewAlbumGallery.link'), }), })}

      ${albumLines - .map(({ album, otherGroup }) => { + .map(({album, otherGroup}) => { const item = album.date - ? language.$("groupInfoPage.albumList.item", { + ? language.$('groupInfoPage.albumList.item', { year: album.date.getFullYear(), album: link.album(album), }) : language.$( - "groupInfoPage.albumList.item.withoutYear", + 'groupInfoPage.albumList.item.withoutYear', { album: link.album(album), } ); return html.tag( - "li", + 'li', otherGroup ? language.$( - "groupInfoPage.albumList.item.withAccent", + 'groupInfoPage.albumList.item.withAccent', { item, accent: html.tag( - "span", - { class: "other-group-accent" }, + 'span', + {class: 'other-group-accent'}, language.$( - "groupInfoPage.albumList.item.otherGroupAccent", + 'groupInfoPage.albumList.item.otherGroupAccent', { group: link.groupInfo(otherGroup, { color: false, @@ -104,7 +104,7 @@ export function write(group, { wikiData }) { : item ); }) - .join("\n")} + .join('\n')}
    `, }, @@ -127,8 +127,8 @@ export function write(group, { wikiData }) { }; const galleryPage = { - type: "page", - path: ["groupGallery", group.directory], + type: 'page', + path: ['groupGallery', group.directory], page: ({ generateInfoGalleryLinks, generatePreviousNextLinks, @@ -138,17 +138,17 @@ export function write(group, { wikiData }) { link, language, }) => ({ - title: language.$("groupGalleryPage.title", { group: group.name }), + title: language.$('groupGalleryPage.title', {group: group.name}), theme: getThemeString(group.color), main: { - classes: ["top-index"], + classes: ['top-index'], content: fixWS` -

    ${language.$("groupGalleryPage.title", { +

    ${language.$('groupGalleryPage.title', { group: group.name, })}

    ${language.$( - "groupGalleryPage.infoLine", + 'groupGalleryPage.infoLine', { tracks: `${language.countTracks(tracks.length, { unit: true, @@ -165,16 +165,16 @@ export function write(group, { wikiData }) { wikiInfo.enableGroupUI && wikiInfo.enableListings && html.tag( - "p", - { class: "quick-info" }, - language.$("groupGalleryPage.anotherGroupLine", { + 'p', + {class: 'quick-info'}, + language.$('groupGalleryPage.anotherGroupLine', { link: link.listing( listingSpec.find( - (l) => l.directory === "groups/by-category" + (l) => l.directory === 'groups/by-category' ), { text: language.$( - "groupGalleryPage.anotherGroupLine.link" + 'groupGalleryPage.anotherGroupLine.link' ), } ), @@ -222,45 +222,45 @@ export function write(group, { wikiData }) { function generateGroupSidebar( currentGroup, isGallery, - { getLinkThemeString, link, language, wikiData } + {getLinkThemeString, link, language, wikiData} ) { - const { groupCategoryData, wikiInfo } = wikiData; + const {groupCategoryData, wikiInfo} = wikiData; if (!wikiInfo.enableGroupUI) { return null; } - const linkKey = isGallery ? "groupGallery" : "groupInfo"; + const linkKey = isGallery ? 'groupGallery' : 'groupInfo'; return { content: fixWS` -

    ${language.$("groupSidebar.title")}

    +

    ${language.$('groupSidebar.title')}

    ${groupCategoryData .map((category) => html.tag( - "details", + 'details', { open: category === currentGroup.category, - class: category === currentGroup.category && "current", + class: category === currentGroup.category && 'current', }, [ html.tag( - "summary", - { style: getLinkThemeString(category.color) }, - language.$("groupSidebar.groupList.category", { + 'summary', + {style: getLinkThemeString(category.color)}, + language.$('groupSidebar.groupList.category', { category: `${category.name}`, }) ), html.tag( - "ul", + 'ul', category.groups.map((group) => html.tag( - "li", + 'li', { - class: group === currentGroup && "current", + class: group === currentGroup && 'current', style: getLinkThemeString(group.color), }, - language.$("groupSidebar.groupList.item", { + language.$('groupSidebar.groupList.item', { group: link[linkKey](group), }) ) @@ -269,7 +269,7 @@ function generateGroupSidebar( ] ) ) - .join("\n")} + .join('\n')} `, }; @@ -286,18 +286,18 @@ function generateGroupNav( wikiData, } ) { - const { groupData, wikiInfo } = wikiData; + const {groupData, wikiInfo} = wikiData; if (!wikiInfo.enableGroupUI) { - return { simple: true }; + return {simple: true}; } - const urlKey = isGallery ? "localized.groupGallery" : "localized.groupInfo"; - const linkKey = isGallery ? "groupGallery" : "groupInfo"; + const urlKey = isGallery ? 'localized.groupGallery' : 'localized.groupInfo'; + const linkKey = isGallery ? 'groupGallery' : 'groupInfo'; const infoGalleryLinks = generateInfoGalleryLinks(currentGroup, isGallery, { - linkKeyGallery: "groupGallery", - linkKeyInfo: "groupInfo", + linkKeyGallery: 'groupGallery', + linkKeyInfo: 'groupInfo', }); const previousNextLinks = generatePreviousNextLinks(currentGroup, { @@ -306,16 +306,16 @@ function generateGroupNav( }); return { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, wikiInfo.enableListings && { - path: ["localized.listingIndex"], - title: language.$("listingIndex.title"), + path: ['localized.listingIndex'], + title: language.$('listingIndex.title'), }, { - html: language.$("groupPage.nav.group", { - group: link[linkKey](currentGroup, { class: "current" }), + html: language.$('groupPage.nav.group', { + group: link[linkKey](currentGroup, {class: 'current'}), }), }, { diff --git a/src/page/homepage.js b/src/page/homepage.js index 8d20accf..7701a73c 100644 --- a/src/page/homepage.js +++ b/src/page/homepage.js @@ -1,23 +1,23 @@ -// @format -// +/** @format */ + // Homepage specification. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; -import * as html from "../util/html.js"; +import * as html from '../util/html.js'; -import { getNewAdditions, getNewReleases } from "../util/wiki-data.js"; +import {getNewAdditions, getNewReleases} from '../util/wiki-data.js'; // Page exports -export function writeTargetless({ wikiData }) { - const { newsData, staticPageData, homepageLayout, wikiInfo } = wikiData; +export function writeTargetless({wikiData}) { + const {newsData, staticPageData, homepageLayout, wikiInfo} = wikiData; const page = { - type: "page", - path: ["home"], + type: 'page', + path: ['home'], page: ({ getAlbumGridHTML, getLinkThemeString, @@ -35,7 +35,7 @@ export function writeTargetless({ wikiData }) { }, main: { - classes: ["top-index"], + classes: ['top-index'], content: fixWS`

    ${wikiInfo.name}

    ${homepageLayout.rows @@ -46,21 +46,21 @@ export function writeTargetless({ wikiData }) { )}">

    ${row.name}

    ${ - row.type === "albums" && + row.type === 'albums' && fixWS`
    ${getAlbumGridHTML({ entries: (row.sourceGroupByRef === - "new-releases" + 'new-releases' ? getNewReleases( row.countAlbumsFromGroup, - { wikiData } + {wikiData} ) : row.sourceGroupByRef === - "new-additions" + 'new-additions' ? getNewAdditions( row.countAlbumsFromGroup, - { wikiData } + {wikiData} ) : (row.sourceGroup?.albums ?? []) .slice() @@ -70,7 +70,7 @@ export function writeTargetless({ wikiData }) { album.isListedOnHomepage ) .slice(0, row.countAlbumsFromGroup) - .map((album) => ({ item: album })) + .map((album) => ({item: album})) ).concat( row.sourceAlbums.map((album) => ({ item: album, @@ -85,11 +85,11 @@ export function writeTargetless({ wikiData }) { ${row.actionLinks .map((action) => transformInline(action).replace( - " ` } @@ -99,7 +99,7 @@ export function writeTargetless({ wikiData }) { ` ) - .join("\n")} + .join('\n')} `, }, @@ -117,21 +117,21 @@ export function writeTargetless({ wikiData }) { // And no, I will not make [[news]] into part of transformMultiline // (even though that would 8e hilarious). content: transformMultiline( - homepageLayout.sidebarContent.replace("[[news]]", "__GENERATE_NEWS__") + homepageLayout.sidebarContent.replace('[[news]]', '__GENERATE_NEWS__') ).replace( - "

    __GENERATE_NEWS__

    ", + '

    __GENERATE_NEWS__

    ', wikiInfo.enableNews ? fixWS` -

    ${language.$("homepage.news.title")}

    +

    ${language.$('homepage.news.title')}

    ${newsData .slice(0, 3) .map((entry, i) => html.tag( - "article", + 'article', { class: [ - "news-entry", - i === 0 && "first-news-entry", + 'news-entry', + i === 0 && 'first-news-entry', ], }, fixWS` @@ -143,42 +143,42 @@ export function writeTargetless({ wikiData }) { entry.contentShort !== entry.content && link.newsEntry(entry, { text: language.$( - "homepage.news.entry.viewRest" + 'homepage.news.entry.viewRest' ), }) } ` ) ) - .join("\n")} + .join('\n')} ` : `

    News requested in content description but this feature isn't enabled

    ` ), }, nav: { - linkContainerClasses: ["nav-links-index"], + linkContainerClasses: ['nav-links-index'], links: [ - link.home("", { text: wikiInfo.nameShort, class: "current", to }), + link.home('', {text: wikiInfo.nameShort, class: 'current', to}), wikiInfo.enableListings && - link.listingIndex("", { - text: language.$("listingIndex.title"), + link.listingIndex('', { + text: language.$('listingIndex.title'), to, }), wikiInfo.enableNews && - link.newsIndex("", { text: language.$("newsIndex.title"), to }), + link.newsIndex('', {text: language.$('newsIndex.title'), to}), wikiInfo.enableFlashesAndGames && - link.flashIndex("", { text: language.$("flashIndex.title"), to }), + link.flashIndex('', {text: language.$('flashIndex.title'), to}), ...staticPageData .filter((page) => page.showInNavigationBar) - .map((page) => link.staticPage(page, { text: page.nameShort })), + .map((page) => link.staticPage(page, {text: page.nameShort})), ] .filter(Boolean) - .map((html) => ({ html })), + .map((html) => ({html})), }, }), }; diff --git a/src/page/index.js b/src/page/index.js index 3d7e6fa8..149503f0 100644 --- a/src/page/index.js +++ b/src/page/index.js @@ -1,5 +1,5 @@ -// @format -// +/** @format */ + // NB: This is the index for the page/ directory and contains exports for all // other modules here! It's not the page spec for the homepage - see // homepage.js for that. @@ -41,15 +41,15 @@ // These functions should be referenced only from adjacent modules, as they // pertain only to site page generation. -export * as album from "./album.js"; -export * as albumCommentary from "./album-commentary.js"; -export * as artist from "./artist.js"; -export * as artistAlias from "./artist-alias.js"; -export * as flash from "./flash.js"; -export * as group from "./group.js"; -export * as homepage from "./homepage.js"; -export * as listing from "./listing.js"; -export * as news from "./news.js"; -export * as static from "./static.js"; -export * as tag from "./tag.js"; -export * as track from "./track.js"; +export * as album from './album.js'; +export * as albumCommentary from './album-commentary.js'; +export * as artist from './artist.js'; +export * as artistAlias from './artist-alias.js'; +export * as flash from './flash.js'; +export * as group from './group.js'; +export * as homepage from './homepage.js'; +export * as listing from './listing.js'; +export * as news from './news.js'; +export * as static from './static.js'; +export * as tag from './tag.js'; +export * as track from './track.js'; diff --git a/src/page/listing.js b/src/page/listing.js index 69fa4919..90415ded 100644 --- a/src/page/listing.js +++ b/src/page/listing.js @@ -1,5 +1,5 @@ -// @format -// +/** @format */ + // Listing page specification. // // The targets here are a bit different than for most pages: rather than data @@ -12,36 +12,36 @@ // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; -import * as html from "../util/html.js"; +import * as html from '../util/html.js'; -import { getTotalDuration } from "../util/wiki-data.js"; +import {getTotalDuration} from '../util/wiki-data.js'; // Page exports -export function condition({ wikiData }) { +export function condition({wikiData}) { return wikiData.wikiInfo.enableListings; } -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.listingSpec; } -export function write(listing, { wikiData }) { - if (listing.condition && !listing.condition({ wikiData })) { +export function write(listing, {wikiData}) { + if (listing.condition && !listing.condition({wikiData})) { return null; } - const { wikiInfo } = wikiData; + const {wikiInfo} = wikiData; - const data = listing.data ? listing.data({ wikiData }) : null; + const data = listing.data ? listing.data({wikiData}) : null; const page = { - type: "page", - path: ["listing", listing.directory], + type: 'page', + path: ['listing', listing.directory], page: (opts) => { - const { getLinkThemeString, link, language } = opts; + const {getLinkThemeString, link, language} = opts; const titleKey = `listingPage.${listing.stringsKey}.title`; return { @@ -63,7 +63,7 @@ export function write(listing, { wikiData }) { ${data .map((item) => listing.row(item, opts)) .map((row) => `
  • ${row}
  • `) - .join("\n")} + .join('\n')} ` } @@ -80,14 +80,14 @@ export function write(listing, { wikiData }) { }, nav: { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, { - path: ["localized.listingIndex"], - title: language.$("listingIndex.title"), + path: ['localized.listingIndex'], + title: language.$('listingIndex.title'), }, - { toCurrentPage: true }, + {toCurrentPage: true}, ], }, }; @@ -97,21 +97,21 @@ export function write(listing, { wikiData }) { return [page]; } -export function writeTargetless({ wikiData }) { - const { albumData, trackData, wikiInfo } = wikiData; +export function writeTargetless({wikiData}) { + const {albumData, trackData, wikiInfo} = wikiData; const totalDuration = getTotalDuration(trackData); const page = { - type: "page", - path: ["listingIndex"], - page: ({ getLinkThemeString, language, link }) => ({ - title: language.$("listingIndex.title"), + type: 'page', + path: ['listingIndex'], + page: ({getLinkThemeString, language, link}) => ({ + title: language.$('listingIndex.title'), main: { content: fixWS` -

    ${language.$("listingIndex.title")}

    -

    ${language.$("listingIndex.infoLine", { +

    ${language.$('listingIndex.title')}

    +

    ${language.$('listingIndex.infoLine', { wiki: wikiInfo.name, tracks: `${language.countTracks(trackData.length, { unit: true, @@ -125,7 +125,7 @@ export function writeTargetless({ wikiData }) { })}`, })}


    -

    ${language.$("listingIndex.exploreList")}

    +

    ${language.$('listingIndex.exploreList')}

    ${generateLinkIndexForListings(null, false, { link, language, @@ -143,7 +143,7 @@ export function writeTargetless({ wikiData }) { }), }, - nav: { simple: true }, + nav: {simple: true}, }), }; @@ -154,11 +154,11 @@ export function writeTargetless({ wikiData }) { function generateSidebarForListings( currentListing, - { getLinkThemeString, link, language, wikiData } + {getLinkThemeString, link, language, wikiData} ) { return fixWS` -

    ${link.listingIndex("", { - text: language.$("listingIndex.title"), +

    ${link.listingIndex('', { + text: language.$('listingIndex.title'), })}

    ${generateLinkIndexForListings(currentListing, true, { getLinkThemeString, @@ -172,24 +172,24 @@ function generateSidebarForListings( function generateLinkIndexForListings( currentListing, forSidebar, - { getLinkThemeString, link, language, wikiData } + {getLinkThemeString, link, language, wikiData} ) { - const { listingTargetSpec, wikiInfo } = wikiData; + const {listingTargetSpec, wikiInfo} = wikiData; const filteredByCondition = listingTargetSpec - .map(({ listings, ...rest }) => ({ + .map(({listings, ...rest}) => ({ ...rest, - listings: listings.filter(({ condition: c }) => !c || c({ wikiData })), + listings: listings.filter(({condition: c}) => !c || c({wikiData})), })) - .filter(({ listings }) => listings.length > 0); + .filter(({listings}) => listings.length > 0); const genUL = (listings) => html.tag( - "ul", + 'ul', listings.map((listing) => html.tag( - "li", - { class: [listing === currentListing && "current"] }, + 'li', + {class: [listing === currentListing && 'current']}, link.listing(listing, { text: language.$(`listingPage.${listing.stringsKey}.title.short`), }) @@ -199,30 +199,30 @@ function generateLinkIndexForListings( if (forSidebar) { return filteredByCondition - .map(({ title, listings }) => + .map(({title, listings}) => html.tag( - "details", + 'details', { open: !forSidebar || listings.includes(currentListing), - class: listings.includes(currentListing) && "current", + class: listings.includes(currentListing) && 'current', }, [ html.tag( - "summary", - { style: getLinkThemeString(wikiInfo.color) }, - html.tag("span", { class: "group-name" }, title({ language })) + 'summary', + {style: getLinkThemeString(wikiInfo.color)}, + html.tag('span', {class: 'group-name'}, title({language})) ), genUL(listings), ] ) ) - .join("\n"); + .join('\n'); } else { return html.tag( - "dl", - filteredByCondition.flatMap(({ title, listings }) => [ - html.tag("dt", title({ language })), - html.tag("dd", genUL(listings)), + 'dl', + filteredByCondition.flatMap(({title, listings}) => [ + html.tag('dt', title({language})), + html.tag('dd', genUL(listings)), ]) ); } diff --git a/src/page/news.js b/src/page/news.js index b988e348..bf581e43 100644 --- a/src/page/news.js +++ b/src/page/news.js @@ -1,40 +1,40 @@ -// @format -// +/** @format */ + // News entry & index page specifications. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; // Page exports -export function condition({ wikiData }) { +export function condition({wikiData}) { return wikiData.wikiInfo.enableNews; } -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.newsData; } -export function write(entry, { wikiData }) { +export function write(entry, {wikiData}) { const page = { - type: "page", - path: ["newsEntry", entry.directory], + type: 'page', + path: ['newsEntry', entry.directory], page: ({ generatePreviousNextLinks, link, language, transformMultiline, }) => ({ - title: language.$("newsEntryPage.title", { entry: entry.name }), + title: language.$('newsEntryPage.title', {entry: entry.name}), main: { content: fixWS`
    -

    ${language.$("newsEntryPage.title", { +

    ${language.$('newsEntryPage.title', { entry: entry.name, })}

    -

    ${language.$("newsEntryPage.published", { +

    ${language.$('newsEntryPage.published', { date: language.formatDate(entry.date), })}

    ${transformMultiline(entry.content)} @@ -54,19 +54,19 @@ export function write(entry, { wikiData }) { return [page]; } -export function writeTargetless({ wikiData }) { - const { newsData } = wikiData; +export function writeTargetless({wikiData}) { + const {newsData} = wikiData; const page = { - type: "page", - path: ["newsIndex"], - page: ({ link, language, transformMultiline }) => ({ - title: language.$("newsIndex.title"), + type: 'page', + path: ['newsIndex'], + page: ({link, language, transformMultiline}) => ({ + title: language.$('newsIndex.title'), main: { content: fixWS`
    -

    ${language.$("newsIndex.title")}

    +

    ${language.$('newsIndex.title')}

    ${newsData .map( (entry) => fixWS` @@ -79,19 +79,19 @@ export function writeTargetless({ wikiData }) { entry.contentShort !== entry.content && `

    ${link.newsEntry(entry, { text: language.$( - "newsIndex.entry.viewRest" + 'newsIndex.entry.viewRest' ), })}

    ` } ` ) - .join("\n")} + .join('\n')}
    `, }, - nav: { simple: true }, + nav: {simple: true}, }), }; @@ -102,9 +102,9 @@ export function writeTargetless({ wikiData }) { function generateNewsEntryNav( entry, - { generatePreviousNextLinks, link, language, wikiData } + {generatePreviousNextLinks, link, language, wikiData} ) { - const { wikiInfo, newsData } = wikiData; + const {wikiInfo, newsData} = wikiData; // The newsData list is sorted reverse chronologically (newest ones first), // so the way we find next/previous entries is flipped from normal. @@ -112,21 +112,21 @@ function generateNewsEntryNav( link, language, data: newsData.slice().reverse(), - linkKey: "newsEntry", + linkKey: 'newsEntry', }); return { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, { - path: ["localized.newsIndex"], - title: language.$("newsEntryPage.nav.news"), + path: ['localized.newsIndex'], + title: language.$('newsEntryPage.nav.news'), }, { - html: language.$("newsEntryPage.nav.entry", { + html: language.$('newsEntryPage.nav.entry', { date: language.formatDate(entry.date), - entry: link.newsEntry(entry, { class: "current" }), + entry: link.newsEntry(entry, {class: 'current'}), }), }, previousNextLinks && { diff --git a/src/page/static.js b/src/page/static.js index ecd77c9a..f4a81972 100644 --- a/src/page/static.js +++ b/src/page/static.js @@ -1,24 +1,24 @@ -// @format -// +/** @format */ + // Static content page specification. (These are static pages coded into the // wiki data folder, used for a variety of purposes, e.g. wiki info, // changelog, and so on.) // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; // Page exports -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.staticPageData; } -export function write(staticPage, { wikiData }) { +export function write(staticPage, {wikiData}) { const page = { - type: "page", - path: ["staticPage", staticPage.directory], - page: ({ language, transformMultiline }) => ({ + type: 'page', + path: ['staticPage', staticPage.directory], + page: ({language, transformMultiline}) => ({ title: staticPage.name, stylesheet: staticPage.stylesheet, @@ -31,7 +31,7 @@ export function write(staticPage, { wikiData }) { `, }, - nav: { simple: true }, + nav: {simple: true}, }), }; diff --git a/src/page/tag.js b/src/page/tag.js index efd95e16..4b2322d0 100644 --- a/src/page/tag.js +++ b/src/page/tag.js @@ -1,34 +1,34 @@ -// @format -// +/** @format */ + // Art tag page specification. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; // Page exports -export function condition({ wikiData }) { +export function condition({wikiData}) { return wikiData.wikiInfo.enableArtTagUI; } -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.artTagData.filter((tag) => !tag.isContentWarning); } -export function write(tag, { wikiData }) { - const { wikiInfo } = wikiData; - const { taggedInThings: things } = tag; +export function write(tag, {wikiData}) { + const {wikiInfo} = wikiData; + const {taggedInThings: things} = tag; // Display things featuring this art tag in reverse chronological order, // sticking the most recent additions near the top! const thingsReversed = things.slice().reverse(); - const entries = thingsReversed.map((item) => ({ item })); + const entries = thingsReversed.map((item) => ({item})); const page = { - type: "page", - path: ["tag", tag.directory], + type: 'page', + path: ['tag', tag.directory], page: ({ generatePreviousNextLinks, getAlbumCover, @@ -39,14 +39,14 @@ export function write(tag, { wikiData }) { language, to, }) => ({ - title: language.$("tagPage.title", { tag: tag.name }), + title: language.$('tagPage.title', {tag: tag.name}), theme: getThemeString(tag.color), main: { - classes: ["top-index"], + classes: ['top-index'], content: fixWS` -

    ${language.$("tagPage.title", { tag: tag.name })}

    -

    ${language.$("tagPage.infoLine", { +

    ${language.$('tagPage.title', {tag: tag.name})}

    +

    ${language.$('tagPage.infoLine', { coverArts: language.countCoverArts(things.length, { unit: true, }), @@ -83,24 +83,24 @@ export function write(tag, { wikiData }) { function generateTagNav( tag, - { generatePreviousNextLinks, link, language, wikiData } + {generatePreviousNextLinks, link, language, wikiData} ) { const previousNextLinks = generatePreviousNextLinks(tag, { data: wikiData.artTagData.filter((tag) => !tag.isContentWarning), - linkKey: "tag", + linkKey: 'tag', }); return { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, wikiData.wikiInfo.enableListings && { - path: ["localized.listingIndex"], - title: language.$("listingIndex.title"), + path: ['localized.listingIndex'], + title: language.$('listingIndex.title'), }, { - html: language.$("tagPage.nav.tag", { - tag: link.tag(tag, { class: "current" }), + html: language.$('tagPage.nav.tag', { + tag: link.tag(tag, {class: 'current'}), }), }, /* diff --git a/src/page/track.js b/src/page/track.js index 5827197d..a9758ec2 100644 --- a/src/page/track.js +++ b/src/page/track.js @@ -1,37 +1,37 @@ -// @format -// +/** @format */ + // Track page specification. // Imports -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; import { generateAlbumChronologyLinks, generateAlbumNavLinks, generateAlbumSecondaryNav, generateAlbumSidebar, -} from "./album.js"; +} from './album.js'; -import * as html from "../util/html.js"; +import * as html from '../util/html.js'; -import { bindOpts } from "../util/sugar.js"; +import {bindOpts} from '../util/sugar.js'; import { getTrackCover, getAlbumListTag, sortChronologically, -} from "../util/wiki-data.js"; +} from '../util/wiki-data.js'; // Page exports -export function targets({ wikiData }) { +export function targets({wikiData}) { return wikiData.trackData; } -export function write(track, { wikiData }) { - const { groupData, wikiInfo } = wikiData; - const { album, referencedByTracks, referencedTracks, otherReleases } = track; +export function write(track, {wikiData}) { + const {groupData, wikiInfo} = wikiData; + const {album, referencedByTracks, referencedTracks, otherReleases} = track; const listTag = getAlbumListTag(album); @@ -50,12 +50,12 @@ export function write(track, { wikiData }) { ); } - const unbound_getTrackItem = (track, { getArtistString, link, language }) => + const unbound_getTrackItem = (track, {getArtistString, link, language}) => html.tag( - "li", - language.$("trackList.item.withArtists", { + 'li', + language.$('trackList.item.withArtists', { track: link.track(track), - by: `${language.$("trackList.item.withArtists.by", { + by: `${language.$('trackList.item.withArtists.by', { artists: getArtistString(track.artistContribs), })}`, }) @@ -63,46 +63,46 @@ export function write(track, { wikiData }) { const unbound_generateTrackList = ( tracks, - { getArtistString, link, language } + {getArtistString, link, language} ) => html.tag( - "ul", + 'ul', tracks.map((track) => - unbound_getTrackItem(track, { getArtistString, link, language }) + unbound_getTrackItem(track, {getArtistString, link, language}) ) ); const hasCommentary = track.commentary || otherReleases.some((t) => t.commentary); - const generateCommentary = ({ link, language, transformMultiline }) => + const generateCommentary = ({link, language, transformMultiline}) => transformMultiline( [ track.commentary, ...otherReleases.map((track) => track.commentary - ?.split("\n") - .filter((line) => line.replace(/<\/b>/g, "").includes(":")) + ?.split('\n') + .filter((line) => line.replace(/<\/b>/g, '').includes(':')) .map( (line) => fixWS` ${line} ${language.$( - "releaseInfo.artistCommentary.seeOriginalRelease", + 'releaseInfo.artistCommentary.seeOriginalRelease', { original: link.track(track), } )} ` ) - .join("\n") + .join('\n') ), ] .filter(Boolean) - .join("\n") + .join('\n') ); const data = { - type: "data", - path: ["track", track.directory], + type: 'data', + path: ['track', track.directory], data: ({ serializeContribs, serializeCover, @@ -145,19 +145,19 @@ export function write(track, { wikiData }) { // they don't get parsed and displayed, generally speaking), so // override the link argument so that artist "links" just show // their names. - link: { artist: (artist) => artist.name }, + link: {artist: (artist) => artist.name}, }); - if (!hasArtists && !hasCoverArtists) return ""; + if (!hasArtists && !hasCoverArtists) return ''; return language.formatString( - "trackPage.socialEmbed.body" + - [hasArtists && ".withArtists", hasCoverArtists && ".withCoverArtists"] + 'trackPage.socialEmbed.body' + + [hasArtists && '.withArtists', hasCoverArtists && '.withCoverArtists'] .filter(Boolean) - .join(""), + .join(''), Object.fromEntries( [ - hasArtists && ["artists", getArtistString(track.artistContribs)], + hasArtists && ['artists', getArtistString(track.artistContribs)], hasCoverArtists && [ - "coverArtists", + 'coverArtists', getArtistString(track.coverArtistContribs), ], ].filter(Boolean) @@ -166,8 +166,8 @@ export function write(track, { wikiData }) { }; const page = { - type: "page", - path: ["track", track.directory], + type: 'page', + path: ['track', track.directory], page: ({ absoluteTo, fancifyURL, @@ -196,24 +196,23 @@ export function write(track, { wikiData }) { const cover = getTrackCover(track); return { - title: language.$("trackPage.title", { track: track.name }), - stylesheet: getAlbumStylesheet(album, { to }), + title: language.$('trackPage.title', {track: track.name}), + stylesheet: getAlbumStylesheet(album, {to}), theme: getThemeString(track.color, [ `--album-directory: ${album.directory}`, `--track-directory: ${track.directory}`, ]), socialEmbed: { - heading: language.$("trackPage.socialEmbed.heading", { + heading: language.$('trackPage.socialEmbed.heading', { album: track.album.name, }), - headingLink: absoluteTo("localized.album", album.directory), - title: language.$("trackPage.socialEmbed.title", { + headingLink: absoluteTo('localized.album', album.directory), + title: language.$('trackPage.socialEmbed.title', { track: track.name, }), - description: getSocialEmbedDescription({ getArtistString, language }), - image: - "/" + getTrackCover(track, { to: urls.from("shared.root").to }), + description: getSocialEmbedDescription({getArtistString, language}), + image: '/' + getTrackCover(track, {to: urls.from('shared.root').to}), color: track.color, }, @@ -234,23 +233,23 @@ export function write(track, { wikiData }) { cover && generateCoverLink({ src: cover, - alt: language.$("misc.alt.trackCover"), + alt: language.$('misc.alt.trackCover'), tags: track.artTags, }) } -

    ${language.$("trackPage.title", { +

    ${language.$('trackPage.title', { track: track.name, })}

    ${[ - language.$("releaseInfo.by", { + language.$('releaseInfo.by', { artists: getArtistString(track.artistContribs, { showContrib: true, showIcons: true, }), }), track.coverArtistContribs.length && - language.$("releaseInfo.coverArtBy", { + language.$('releaseInfo.coverArtBy', { artists: getArtistString( track.coverArtistContribs, { @@ -260,45 +259,45 @@ export function write(track, { wikiData }) { ), }), track.date && - language.$("releaseInfo.released", { + language.$('releaseInfo.released', { date: language.formatDate(track.date), }), track.coverArtDate && +track.coverArtDate !== +track.date && - language.$("releaseInfo.artReleased", { + language.$('releaseInfo.artReleased', { date: language.formatDate(track.coverArtDate), }), track.duration && - language.$("releaseInfo.duration", { + language.$('releaseInfo.duration', { duration: language.formatDuration( track.duration ), }), ] .filter(Boolean) - .join("
    \n")} + .join('
    \n')}

    ${ track.urls?.length - ? language.$("releaseInfo.listenOn", { + ? language.$('releaseInfo.listenOn', { links: language.formatDisjunctionList( track.urls.map((url) => - fancifyURL(url, { language }) + fancifyURL(url, {language}) ) ), }) - : language.$("releaseInfo.listenOn.noLinks") + : language.$('releaseInfo.listenOn.noLinks') }

    ${ otherReleases.length && fixWS` -

    ${language.$("releaseInfo.alsoReleasedAs")}

    +

    ${language.$('releaseInfo.alsoReleasedAs')}

      ${otherReleases .map( (track) => fixWS`
    • ${language.$( - "releaseInfo.alsoReleasedAs.item", + 'releaseInfo.alsoReleasedAs.item', { track: link.track(track), album: link.album(track.album), @@ -306,14 +305,14 @@ export function write(track, { wikiData }) { )}
    • ` ) - .join("\n")} + .join('\n')}
    ` } ${ track.contributorContribs.length && fixWS` -

    ${language.$("releaseInfo.contributors")}

    +

    ${language.$('releaseInfo.contributors')}

      ${track.contributorContribs .map( @@ -323,18 +322,18 @@ export function write(track, { wikiData }) { showIcons: true, })}` ) - .join("\n")} + .join('\n')}
    ` } ${ referencedTracks.length && fixWS` -

    ${language.$("releaseInfo.tracksReferenced", { +

    ${language.$('releaseInfo.tracksReferenced', { track: `${track.name}`, })}

    ${html.tag( - "ul", + 'ul', referencedTracks.map(getTrackItem) )} ` @@ -342,7 +341,7 @@ export function write(track, { wikiData }) { ${ referencedByTracks.length && fixWS` -

    ${language.$("releaseInfo.tracksThatReference", { +

    ${language.$('releaseInfo.tracksThatReference', { track: `${track.name}`, })}

    ${generateTrackListDividedByGroups( @@ -358,24 +357,24 @@ export function write(track, { wikiData }) { wikiInfo.enableFlashesAndGames && flashesThatFeature.length && fixWS` -

    ${language.$("releaseInfo.flashesThatFeature", { +

    ${language.$('releaseInfo.flashesThatFeature', { track: `${track.name}`, })}

      ${flashesThatFeature - .map(({ flash, as }) => + .map(({flash, as}) => html.tag( - "li", - { class: as !== track && "rerelease" }, + 'li', + {class: as !== track && 'rerelease'}, as === track ? language.$( - "releaseInfo.flashesThatFeature.item", + 'releaseInfo.flashesThatFeature.item', { flash: link.flash(flash), } ) : language.$( - "releaseInfo.flashesThatFeature.item.asDifferentRelease", + 'releaseInfo.flashesThatFeature.item.asDifferentRelease', { flash: link.flash(flash), track: link.track(as), @@ -383,14 +382,14 @@ export function write(track, { wikiData }) { ) ) ) - .join("\n")} + .join('\n')}
    ` } ${ track.lyrics && fixWS` -

    ${language.$("releaseInfo.lyrics")}

    +

    ${language.$('releaseInfo.lyrics')}

    ${transformLyrics(track.lyrics)}
    @@ -399,7 +398,7 @@ export function write(track, { wikiData }) { ${ hasCommentary && fixWS` -

    ${language.$("releaseInfo.artistCommentary")}

    +

    ${language.$('releaseInfo.artistCommentary')}

    ${generateCommentary({ link, @@ -422,23 +421,23 @@ export function write(track, { wikiData }) { }), nav: { - linkContainerClasses: ["nav-links-hierarchy"], + linkContainerClasses: ['nav-links-hierarchy'], links: [ - { toHome: true }, + {toHome: true}, { - path: ["localized.album", album.directory], + path: ['localized.album', album.directory], title: album.name, }, - listTag === "ol" + listTag === 'ol' ? { - html: language.$("trackPage.nav.track.withNumber", { + html: language.$('trackPage.nav.track.withNumber', { number: album.tracks.indexOf(track) + 1, - track: link.track(track, { class: "current", to }), + track: link.track(track, {class: 'current', to}), }), } : { - html: language.$("trackPage.nav.track", { - track: link.track(track, { class: "current", to }), + html: language.$('trackPage.nav.track', { + track: link.track(track, {class: 'current', to}), }), }, ].filter(Boolean), -- cgit 1.3.0-6-gf8a5