diff options
Diffstat (limited to 'src/page')
-rw-r--r-- | src/page/album-commentary.js | 26 | ||||
-rw-r--r-- | src/page/album.js | 72 | ||||
-rw-r--r-- | src/page/artist-alias.js | 2 | ||||
-rw-r--r-- | src/page/artist.js | 30 | ||||
-rw-r--r-- | src/page/flash.js | 63 | ||||
-rw-r--r-- | src/page/group.js | 18 | ||||
-rw-r--r-- | src/page/homepage.js | 8 | ||||
-rw-r--r-- | src/page/listing.js | 14 | ||||
-rw-r--r-- | src/page/news.js | 83 | ||||
-rw-r--r-- | src/page/static.js | 16 | ||||
-rw-r--r-- | src/page/tag.js | 9 | ||||
-rw-r--r-- | src/page/track.js | 29 |
12 files changed, 159 insertions, 211 deletions
diff --git a/src/page/album-commentary.js b/src/page/album-commentary.js index 74eee2b0..5fd78beb 100644 --- a/src/page/album-commentary.js +++ b/src/page/album-commentary.js @@ -4,6 +4,8 @@ import {generateAlbumExtrasPageNav} from './album.js'; import {accumulateSum} from '../util/sugar.js'; import {filterAlbumsByCommentary} from '../util/wiki-data.js'; +export const description = `per-album artist commentary pages & index` + export function condition({wikiData}) { return filterAlbumsByCommentary(wikiData.albumData).length; } @@ -22,7 +24,6 @@ export function write(album) { type: 'page', path: ['albumCommentary', album.directory], page: ({ - generateStickyHeadingContainer, getAlbumStylesheet, getLinkThemeString, getThemeString, @@ -36,13 +37,10 @@ export function write(album) { theme: getThemeString(album.color), main: { - content: html.tag('div', {class: 'long-content'}, [ - generateStickyHeadingContainer({ - title: language.$('albumCommentaryPage.title', { - album: album.name, - }), - }), + classes: ['long-content'], + headingMode: 'sticky', + content: [ html.tag('p', language.$('albumCommentaryPage.infoLine', { words: html.tag('b', language.formatWordCount(words, {unit: true})), @@ -68,7 +66,7 @@ export function write(album) { {style: getLinkThemeString(track.color)}, transformMultiline(track.commentary)), ]) - ]), + ], }, nav: generateAlbumExtrasPageNav(album, 'commentary', { @@ -110,20 +108,24 @@ export function writeTargetless({wikiData}) { title: language.$('commentaryIndex.title'), main: { - content: html.tag('div', {class: 'long-content'}, [ - html.tag('h1', language.$('commentaryIndex.title')), + classes: ['long-content'], + headingMode: 'static', + + content: [ html.tag('p', language.$('commentaryIndex.infoLine', { words: html.tag('b', language.formatWordCount(totalWords, {unit: true})), entries: html.tag('b', language.countCommentaryEntries(totalEntries, {unit: true})), })), + html.tag('p', language.$('commentaryIndex.albumList.title')), + html.tag('ul', data.map(({album, entries, words}) => html.tag('li', language.$('commentaryIndex.albumList.item', { album: link.albumCommentary(album), words: language.formatWordCount(words, {unit: true}), entries: language.countCommentaryEntries(entries.length, {unit: true}), - })))) - ]), + })))), + ], }, nav: {simple: true}, diff --git a/src/page/album.js b/src/page/album.js index 80397065..897e5110 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -12,6 +12,8 @@ import { getTotalDuration, } from '../util/wiki-data.js'; +export const description = `per-album info & track artwork gallery pages`; + export function targets({wikiData}) { return wikiData.albumData; } @@ -50,10 +52,10 @@ export function write(album, {wikiData}) { const hasAdditionalFiles = !empty(album.additionalFiles); const albumDuration = getTotalDuration(album.tracks); - const displayTrackGroups = - album.trackGroups && - (album.trackGroups.length > 1 || - !album.trackGroups[0]?.isDefaultTrackGroup); + const displayTrackSections = + album.trackSections && + (album.trackSections.length > 1 || + !album.trackSections[0]?.isDefaultTrackSection); const listTag = getAlbumListTag(album); @@ -107,10 +109,10 @@ export function write(album, {wikiData}) { wallpaperArtistContribs: serializeContribs(album.wallpaperArtistContribs), bannerArtistContribs: serializeContribs(album.bannerArtistContribs), groups: serializeGroupsForAlbum(album), - trackGroups: album.trackGroups?.map((trackGroup) => ({ - name: trackGroup.name, - color: trackGroup.color, - tracks: trackGroup.tracks.map((track) => track.directory), + trackSections: album.trackSections?.map((section) => ({ + name: section.name, + color: section.color, + tracks: section.tracks.map((track) => track.directory), })), tracks: album.tracks.map((track) => ({ link: serializeLink(track), @@ -128,9 +130,7 @@ export function write(album, {wikiData}) { generateAdditionalFilesShortcut, generateAdditionalFilesList, generateChronologyLinks, - generateCoverLink, generateNavigationLinks, - generateStickyHeadingContainer, getAlbumCover, getAlbumStylesheet, getArtistString, @@ -151,8 +151,6 @@ export function write(album, {wikiData}) { link, }); - const cover = getAlbumCover(album); - return { title: language.$('albumPage.title', {album: album.name}), stylesheet: getAlbumStylesheet(album), @@ -195,22 +193,16 @@ export function write(album, {wikiData}) { position: 'top', }, - main: { - content: [ - generateStickyHeadingContainer({ - title: language.$('albumPage.title', {album: album.name}), - - coverSrc: cover, - coverAlt: language.$('misc.alt.albumCover'), - coverTags: album.artTags, - }), + cover: { + src: getAlbumCover(album), + alt: language.$('misc.alt.albumCover'), + artTags: album.artTags, + }, - cover && generateCoverLink({ - src: cover, - alt: language.$('misc.alt.albumCover'), - tags: album.artTags, - }), + main: { + headingMode: 'sticky', + content: [ html.tag('p', { [html.onlyIfContent]: true, @@ -254,6 +246,7 @@ export function write(album, {wikiData}) { date: language.formatDate(album.date), }), + album.hasCoverArt && album.coverArtDate && +album.coverArtDate !== +album.date && language.$('releaseInfo.artReleased', { @@ -300,11 +293,11 @@ export function write(album, {wikiData}) { ), })), - displayTrackGroups && - !empty(album.trackGroups) && + displayTrackSections && + !empty(album.trackSections) && html.tag('dl', {class: 'album-group-list'}, - album.trackGroups.flatMap(({ + album.trackSections.flatMap(({ name, startIndex, tracks, @@ -323,7 +316,7 @@ export function write(album, {wikiData}) { tracks.map(trackToListItem))), ])), - !displayTrackGroups && + !displayTrackSections && !empty(album.tracks) && html.tag(listTag, album.tracks.map(trackToListItem)), @@ -436,12 +429,9 @@ export function write(album, {wikiData}) { main: { classes: ['top-index'], - content: [ - html.tag('h1', - language.$('albumGalleryPage.title', { - album: album.name, - })), + headingMode: 'static', + content: [ html.tag('p', {class: 'quick-info'}, (album.date @@ -517,7 +507,7 @@ export function generateAlbumSidebar(album, currentTrack, { const listTag = getAlbumListTag(album); - const {trackGroups} = album; + const {trackSections} = album; const trackToListItem = (track) => html.tag('li', @@ -526,19 +516,19 @@ export function generateAlbumSidebar(album, currentTrack, { track: link.track(track), })); - const nameOrDefault = (isDefaultTrackGroup, name) => - isDefaultTrackGroup - ? language.$('albumSidebar.trackList.fallbackGroupName') + const nameOrDefault = (isDefaultTrackSection, name) => + isDefaultTrackSection + ? language.$('albumSidebar.trackList.fallbackSectionName') : name; const trackListPart = [ html.tag('h1', link.album(album)), - ...trackGroups.map(({name, color, startIndex, tracks, isDefaultTrackGroup}) => { + ...trackSections.map(({name, color, startIndex, tracks, isDefaultTrackSection}) => { const groupName = html.tag('span', {class: 'group-name'}, nameOrDefault( - isDefaultTrackGroup, + isDefaultTrackSection, name )); return html.tag('details', diff --git a/src/page/artist-alias.js b/src/page/artist-alias.js index e2b16046..f867d123 100644 --- a/src/page/artist-alias.js +++ b/src/page/artist-alias.js @@ -1,6 +1,8 @@ // Artist alias redirect pages. // (Makes old permalinks bring visitors to the up-to-date page.) +export const description = `redirects for aliased artist names`; + export function targets({wikiData}) { return wikiData.artistAliasData; } diff --git a/src/page/artist.js b/src/page/artist.js index 235fe113..87859c89 100644 --- a/src/page/artist.js +++ b/src/page/artist.js @@ -15,6 +15,8 @@ import { sortChronologically, } from '../util/wiki-data.js'; +export const description = `per-artist info & artwork gallery pages`; + export function targets({wikiData}) { return wikiData.artistData; } @@ -319,9 +321,7 @@ export function write(artist, {wikiData}) { path: ['artist', artist.directory], page: ({ fancifyURL, - generateCoverLink, generateInfoGalleryLinks, - generateStickyHeadingContainer, getArtistAvatar, getArtistString, html, @@ -339,20 +339,15 @@ export function write(artist, {wikiData}) { return { title: language.$('artistPage.title', {artist: name}), - main: { - content: [ - artist.hasAvatar && - generateCoverLink({ - src: getArtistAvatar(artist), - alt: language.$('misc.alt.artistAvatar'), - }), + cover: artist.hasAvatar && { + src: getArtistAvatar(artist), + alt: language.$('misc.alt.artistAvatar'), + }, - generateStickyHeadingContainer({ - title: language.$('artistPage.title', { - artist: name, - }), - }), + main: { + headingMode: 'sticky', + content: [ ...html.fragment( contextNotes && [ html.tag('p', @@ -608,12 +603,9 @@ export function write(artist, {wikiData}) { main: { classes: ['top-index'], - content: [ - html.tag('h1', - language.$('artistGalleryPage.title', { - artist: name, - })), + headingMode: 'static', + content: [ html.tag('p', {class: 'quick-info'}, language.$('artistGalleryPage.infoLine', { diff --git a/src/page/flash.js b/src/page/flash.js index 581092a6..a9ce053d 100644 --- a/src/page/flash.js +++ b/src/page/flash.js @@ -3,6 +3,8 @@ import {empty} from '../util/sugar.js'; import {getFlashLink} from '../util/wiki-data.js'; +export const description = `flash & game pages`; + export function condition({wikiData}) { return wikiData.wikiInfo.enableFlashesAndGames; } @@ -18,9 +20,7 @@ export function write(flash, {wikiData}) { page: ({ fancifyFlashURL, generateChronologyLinks, - generateCoverLink, generateNavigationLinks, - generateStickyHeadingContainer, getArtistString, getFlashCover, getThemeString, @@ -38,19 +38,15 @@ export function write(flash, {wikiData}) { ], }), - main: { - content: [ - generateStickyHeadingContainer({ - title: language.$('flashPage.title', { - flash: flash.name, - }), - }), + cover: { + src: getFlashCover(flash), + alt: language.$('misc.alt.flashArt'), + }, - generateCoverLink({ - src: getFlashCover(flash), - alt: language.$('misc.alt.flashArt'), - }), + main: { + headingMode: 'sticky', + content: [ html.tag('p', language.$('releaseInfo.released', { date: language.formatDate(flash.date), @@ -144,30 +140,25 @@ export function writeTargetless({ main: { classes: ['flash-index'], - content: [ - html.tag('h1', - language.$('flashIndex.title')), + headingMode: 'static', - html.tag('div', - {class: 'long-content'}, - [ - html.tag('p', - {class: 'quick-info'}, - language.$('misc.jumpTo')), - - html.tag('ul', - {class: 'quick-info'}, - flashActData - .filter(act => act.jump) - .map(({anchor, jump, jumpColor}) => - html.tag('li', - html.tag('a', - { - href: '#' + anchor, - style: getLinkThemeString(jumpColor), - }, - jump)))), - ]), + content: [ + html.tag('p', + {class: 'quick-info'}, + language.$('misc.jumpTo')), + + html.tag('ul', + {class: 'quick-info'}, + flashActData + .filter(act => act.jump) + .map(({anchor, jump, jumpColor}) => + html.tag('li', + html.tag('a', + { + href: '#' + anchor, + style: getLinkThemeString(jumpColor), + }, + jump)))), ...flashActData.flatMap((act, i) => [ html.tag('h2', diff --git a/src/page/group.js b/src/page/group.js index f9af8e80..9a48c1d8 100644 --- a/src/page/group.js +++ b/src/page/group.js @@ -9,6 +9,8 @@ import { sortChronologically, } from '../util/wiki-data.js'; +export const description = `per-group info & album gallery pages`; + export function targets({wikiData}) { return wikiData.groupData; } @@ -31,7 +33,6 @@ export function write(group, {wikiData}) { fancifyURL, generateInfoGalleryLinks, generateNavigationLinks, - generateStickyHeadingContainer, getLinkThemeString, getThemeString, html, @@ -45,13 +46,9 @@ export function write(group, {wikiData}) { theme: getThemeString(group.color), main: { - content: [ - generateStickyHeadingContainer({ - title: language.$('groupInfoPage.title', { - group: group.name - }), - }), + headingMode: 'sticky', + content: [ !empty(group.urls) && html.tag('p', language.$('releaseInfo.visitOn', { @@ -144,12 +141,9 @@ export function write(group, {wikiData}) { main: { classes: ['top-index'], - content: [ - html.tag('h1', - language.$('groupGalleryPage.title', { - group: group.name, - })), + headingMode: 'static', + content: [ getCarouselHTML({ items: group.featuredAlbums.slice(0, 12 + 1), srcFn: getAlbumCover, diff --git a/src/page/homepage.js b/src/page/homepage.js index cb1e1da1..465152aa 100644 --- a/src/page/homepage.js +++ b/src/page/homepage.js @@ -11,6 +11,8 @@ import { getNewReleases, } from '../util/wiki-data.js'; +export const description = `main wiki homepage`; + export function writeTargetless({wikiData}) { const {newsData, homepageLayout, wikiInfo} = wikiData; @@ -82,7 +84,9 @@ export function writeTargetless({wikiData}) { main: { classes: ['top-index'], - content: html.fragment([ + headingMode: 'none', + + content: [ html.tag('h1', wikiInfo.name), @@ -134,7 +138,7 @@ export function writeTargetless({wikiData}) { })), ]), ]))), - ]), + ], }, sidebarLeft: homepageLayout.sidebarContent && { diff --git a/src/page/listing.js b/src/page/listing.js index dce38526..2412efe6 100644 --- a/src/page/listing.js +++ b/src/page/listing.js @@ -12,6 +12,8 @@ import {empty} from '../util/sugar.js'; import {getTotalDuration} from '../util/wiki-data.js'; +export const description = `wiki-wide listing pages & index`; + export function condition({wikiData}) { return wikiData.wikiInfo.enableListings; } @@ -32,7 +34,6 @@ export function write(listing, {wikiData}) { path: ['listing', listing.directory], page: (opts) => { const { - generateStickyHeadingContainer, getLinkThemeString, html, language, @@ -45,11 +46,9 @@ export function write(listing, {wikiData}) { title: language.$(titleKey), main: { - content: [ - generateStickyHeadingContainer({ - title: language.$(titleKey), - }), + headingMode: 'sticky', + content: [ ...html.fragment( listing.html && (listing.data @@ -109,10 +108,9 @@ export function writeTargetless({wikiData}) { title: language.$('listingIndex.title'), main: { - content: [ - html.tag('h1', - language.$('listingIndex.title')), + headingMode: 'static', + content: [ html.tag('p', language.$('listingIndex.infoLine', { wiki: wikiInfo.name, diff --git a/src/page/news.js b/src/page/news.js index 61a52dc0..00d1e4dc 100644 --- a/src/page/news.js +++ b/src/page/news.js @@ -1,5 +1,7 @@ // News entry & index page specifications. +export const description = `per-entry news pages & index`; + export function condition({wikiData}) { return wikiData.wikiInfo.enableNews; } @@ -14,7 +16,6 @@ export function write(entry, {wikiData}) { path: ['newsEntry', entry.directory], page: ({ generateNavigationLinks, - generateStickyHeadingContainer, html, language, link, @@ -23,22 +24,16 @@ export function write(entry, {wikiData}) { title: language.$('newsEntryPage.title', {entry: entry.name}), main: { + classes: ['long-content'], + headingMode: 'sticky', + content: [ - generateStickyHeadingContainer({ - class: ['long-content'], - title: language.$('newsEntryPage.title', { - entry: entry.name, - }), - }), - - html.tag('div', {class: 'long-content'}, [ - html.tag('p', - language.$('newsEntryPage.published', { - date: language.formatDate(entry.date), - })), - - transformMultiline(entry.content), - ]), + html.tag('p', + language.$('newsEntryPage.published', { + date: language.formatDate(entry.date), + })), + + transformMultiline(entry.content), ], }, @@ -62,7 +57,6 @@ export function writeTargetless({wikiData}) { type: 'page', path: ['newsIndex'], page: ({ - generateStickyHeadingContainer, html, language, link, @@ -71,37 +65,30 @@ export function writeTargetless({wikiData}) { title: language.$('newsIndex.title'), main: { - content: [ - generateStickyHeadingContainer({ - class: ['long-content'], - title: language.$('newsIndex.title'), - }), - - html.tag('div', - {class: ['long-content', 'news-index']}, - [ - ...newsData.map(entry => - html.tag('article', - {id: entry.directory}, - [ - html.tag('h2', [ - html.tag('time', - language.formatDate(entry.date)), - link.newsEntry(entry), - ]), - - transformMultiline(entry.contentShort), - - entry.contentShort !== entry.content && - html.tag('p', - link.newsEntry(entry, { - text: language.$( - 'newsIndex.entry.viewRest' - ), - })), - ])), - ]), - ], + classes: ['long-content', 'news-index'], + headingMode: 'sticky', + + content: + newsData.map(entry => + html.tag('article', + {id: entry.directory}, + [ + html.tag('h2', [ + html.tag('time', + language.formatDate(entry.date)), + link.newsEntry(entry), + ]), + + transformMultiline(entry.contentShort), + + entry.contentShort !== entry.content && + html.tag('p', + link.newsEntry(entry, { + text: language.$( + 'newsIndex.entry.viewRest' + ), + })), + ])), }, nav: {simple: true}, diff --git a/src/page/static.js b/src/page/static.js index 1689d16b..8572db4e 100644 --- a/src/page/static.js +++ b/src/page/static.js @@ -2,6 +2,8 @@ // wiki data folder, used for a variety of purposes, e.g. wiki info, // changelog, and so on.) +export const description = `static wiki-wide content pages specified in data`; + export function targets({wikiData}) { return wikiData.staticPageData; } @@ -11,22 +13,16 @@ export function write(staticPage) { type: 'page', path: ['staticPage', staticPage.directory], page: ({ - generateStickyHeadingContainer, - html, transformMultiline, }) => ({ title: staticPage.name, stylesheet: staticPage.stylesheet, main: { - content: [ - generateStickyHeadingContainer({ - class: ['long-content'], - title: staticPage.name, - }), - html.tag('div', {class: 'long-content'}, - transformMultiline(staticPage.content)), - ], + classes: ['long-content'], + headingMode: 'sticky', + + content: transformMultiline(staticPage.content), }, nav: {simple: true}, diff --git a/src/page/tag.js b/src/page/tag.js index da4f194a..81db6137 100644 --- a/src/page/tag.js +++ b/src/page/tag.js @@ -1,5 +1,7 @@ // Art tag page specification. +export const description = `per-artwork-tag gallery pages`; + export function condition({wikiData}) { return wikiData.wikiInfo.enableArtTagUI; } @@ -34,12 +36,9 @@ export function write(tag, {wikiData}) { main: { classes: ['top-index'], - content: [ - html.tag('h1', - language.$('tagPage.title', { - tag: tag.name, - })), + headingMode: 'static', + content: [ html.tag('p', {class: 'quick-info'}, language.$('tagPage.infoLine', { diff --git a/src/page/track.js b/src/page/track.js index 94c9c40a..caba3668 100644 --- a/src/page/track.js +++ b/src/page/track.js @@ -18,6 +18,8 @@ import { sortChronologically, } from '../util/wiki-data.js'; +export const description = `per-track info pages`; + export function targets({wikiData}) { return wikiData.trackData; } @@ -160,9 +162,7 @@ export function write(track, {wikiData}) { absoluteTo, fancifyURL, generateChronologyLinks, - generateCoverLink, generateNavigationLinks, - generateStickyHeadingContainer, generateTrackListDividedByGroups, getAlbumStylesheet, getArtistString, @@ -183,7 +183,6 @@ export function write(track, {wikiData}) { language, link, }); - const cover = getTrackCover(track); return { title: language.$('trackPage.title', {track: track.name}), @@ -222,22 +221,16 @@ export function write(track, {wikiData}) { }, */ - main: { - content: [ - generateStickyHeadingContainer({ - title: language.$('trackPage.title', {track: track.name}), - - coverSrc: cover, - coverAlt: language.$('misc.alt.trackCover'), - coverTags: track.artTags, - }), + cover: { + src: getTrackCover(track), + alt: language.$('misc.alt.trackCover'), + artTags: track.artTags, + }, - cover && generateCoverLink({ - src: cover, - alt: language.$('misc.alt.trackCover'), - tags: track.artTags, - }), + main: { + headingMode: 'sticky', + content: [ html.tag('p', { [html.onlyIfContent]: true, @@ -265,7 +258,7 @@ export function write(track, {wikiData}) { date: language.formatDate(track.date), }), - cover && + track.hasCoverArt && track.coverArtDate && +track.coverArtDate !== +track.date && language.$('releaseInfo.artReleased', { |