From b4fddee310a8f918698301702e93c46963cb6a64 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 1 Mar 2020 20:58:22 -0400 Subject: fanon + Diverging Delicacies --- upd8.js | 51 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 9 deletions(-) (limited to 'upd8.js') diff --git a/upd8.js b/upd8.js index f84226c1..ad7eb237 100644 --- a/upd8.js +++ b/upd8.js @@ -325,6 +325,8 @@ async function processAlbumDataFile(file) { const albumCommentary = getCommentaryField(albumSection); let albumDirectory = getBasicField(albumSection, 'Directory'); + const isFanon = getBasicField(albumSection, 'Canon') === 'Fanon'; + if (albumCoverArtists && albumCoverArtists.error) { return albumCoverArtists; } @@ -382,6 +384,7 @@ async function processAlbumDataFile(file) { coverArtists: albumCoverArtists, commentary: albumCommentary, directory: albumDirectory, + isFanon, theme: { fg: albumColorFG, bg: albumColorBG, @@ -477,6 +480,7 @@ async function processAlbumDataFile(file) { date, directory: trackDirectory, urls: trackURLs, + isFanon, // 8ack-reference the al8um o8ject! This is very useful for when // we're outputting the track pages. album: albumData @@ -622,8 +626,19 @@ function writeMiscellaneousPages(albumData, flashData) { Feedback

...or choose an album:

+

Fandom

- ${albumData.map(album => fixWS` + ${albumData.filter(album => album.isFanon).map(album => fixWS` + + + ${album.name} + + `).join('\n')} + ...and more to be added soon +
+

Official

+
+ ${albumData.filter(album => !album.isFanon).map(album => fixWS` ${album.name} @@ -738,6 +753,8 @@ async function writeTrackPage(track, albumData, flashData) { const artistNames = getArtistNames(albumData); const allTracks = getAllTracks(albumData); const tracksThatReference = getTracksThatReference(track, allTracks); + const ttrFanon = tracksThatReference.filter(t => t.isFanon); + const ttrCanon = tracksThatReference.filter(t => !t.isFanon); const tracksReferenced = getTracksReferencedBy(track, allTracks); const flashesThatFeature = getFlashesThatFeature(track, allTracks, flashData); await writePage([TRACK_DIRECTORY, track.directory], track.name, fixWS` @@ -787,14 +804,30 @@ async function writeTrackPage(track, albumData, flashData) { `} ${tracksThatReference.length && fixWS`

Tracks that reference ${track.name}:

-
+
+ ${ttrCanon.length && fixWS` +
Official:
+
    + ${ttrCanon.map(track => fixWS` +
  • + ${track.name} + by ${getArtistString(track.artists, albumData)} +
  • + `).join('\n')} +
+ `} + ${ttrFanon.length && fixWS` +
Fandom:
+
    + ${ttrFanon.map(track => fixWS` +
  • + ${track.name} + by ${getArtistString(track.artists, albumData)} +
  • + `).join('\n')} +
+ `} +
`} ${flashesThatFeature.length && fixWS`

Flashes that feature ${track.name}:

-- cgit 1.3.0-6-gf8a5