From 32a6e8b5ddb79f4141c51530732e0923f21ac71a Mon Sep 17 00:00:00 2001
From: "(quasar) nebula"
Date: Tue, 2 Feb 2021 16:55:29 -0400
Subject: major rework of CSS theme variable internals
---
package.json | 2 +-
static/site.css | 34 ++++-----
upd8.js | 212 ++++++++++++++++++++++++++++----------------------------
3 files changed, 120 insertions(+), 128 deletions(-)
mode change 100644 => 100755 upd8.js
diff --git a/package.json b/package.json
index 4ae318e3..a0495520 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"hsmusic": "./upd8.js"
},
"dependencies": {
- "fix-whitespace": "^1.0.3",
+ "fix-whitespace": "^1.0.4",
"mkdirp": "^0.5.5"
},
"license": "GPL-3.0"
diff --git a/static/site.css b/static/site.css
index f0e10bb8..585fca05 100644
--- a/static/site.css
+++ b/static/site.css
@@ -3,21 +3,11 @@
* no need to re-run upd8.js when tweaking values here. Handy!
*/
-/* Pages can specify their own theme colors (used for links, and may8e other
- * things) by changing this CSS varia8le through their 8ody's style attri8ute.
- * And yes, CSS varia8les are supported in 8asically every major 8rowser.
- * No, I don't care a8out Internet Explorer.
- */
:root {
- --fg-color: #0088ff;
- --bg-color: #222222;
- --theme: 0; /* 0: dark (below light), 1: light (below dark) */
- --bg: url("../media/bg.jpg");
+ --primary-color: #0088ff;
}
body {
- --bg-shade: calc(255 * var(--theme));
- --fg-shade: calc(255 * (1 - var(--theme)));
background: black;
margin: 10px;
overflow-y: scroll;
@@ -32,15 +22,15 @@ body::before {
height: 100%;
z-index: -1;
- background-image: var(--bg);
+ background-image: url("../media/bg.jpg");
background-position: center;
background-size: cover;
opacity: 0.5;
}
#page-container {
- background-color: var(--bg-color);
- color: rgb(var(--fg-shade), var(--fg-shade), var(--fg-shade));
+ background-color: #222222;
+ color: #ffffff;
max-width: 1100px;
margin: 10px auto 50px;
@@ -50,7 +40,7 @@ body::before {
}
a {
- color: var(--fg-color);
+ color: var(--primary-color);
text-decoration: none;
}
@@ -170,7 +160,7 @@ footer > :last-child {
height: 24px;
top: -0.25em;
position: absolute;
- fill: var(--fg-color);
+ fill: var(--primary-color);
}
.rerelease {
@@ -192,8 +182,8 @@ footer > :last-child {
}
.sidebar, #content, #header, #skippers, #footer {
- background-color: rgba(var(--bg-shade), var(--bg-shade), var(--bg-shade), 0.6);
- border: 1px dotted var(--fg-color);
+ background-color: rgba(0, 0, 0, 0.6);
+ border: 1px dotted var(--primary-color);
border-radius: 3px;
}
@@ -351,7 +341,7 @@ footer > :last-child {
}
.image-container {
- border: 2px solid var(--fg-color);
+ border: 2px solid var(--primary-color);
box-sizing: border-box;
position: relative;
padding: 5px;
@@ -386,7 +376,7 @@ img {
}
a.box:focus {
- outline: 3px double var(--fg-color);
+ outline: 3px double var(--primary-color);
}
a.box:focus:not(:focus-visible) {
@@ -423,7 +413,7 @@ h1 {
margin: 15px;
text-align: center;
background-color: #111111;
- border: 1px dotted var(--fg-color);
+ border: 1px dotted var(--primary-color);
border-radius: 2px;
padding: 5px;
}
@@ -593,7 +583,7 @@ ul.quick-info li:not(:last-child)::after {
padding: 10px;
background-color: #222222;
text-align: center;
- border: 1px dotted var(--fg-color);
+ border: 1px dotted var(--primary-color);
border-radius: 2px;
}
diff --git a/upd8.js b/upd8.js
old mode 100644
new mode 100755
index 77e2a3d7..01a3cb2b
--- a/upd8.js
+++ b/upd8.js
@@ -293,7 +293,7 @@ function transformInline(text) {
const album = getLinkedAlbum(ref);
if (album) {
return fixWS`
- ${album.name}
+ ${album.name}
`;
} else {
console.warn(`\x1b[33mThe linked album ${match} does not exist!\x1b[0m`);
@@ -328,7 +328,7 @@ function transformInline(text) {
const track = getLinkedTrack(ref);
if (track) {
return fixWS`
- ${track.name}
+ ${track.name}
`;
} else {
console.warn(`\x1b[33mThe linked track ${match} does not exist!\x1b[0m`);
@@ -338,7 +338,7 @@ function transformInline(text) {
const tag = getLinkedTag(ref);
if (tag) {
return fixWS`
- ${tag.name}
+ ${tag.name}
`;
} else {
console.warn(`\x1b[33mThe linked tag ${match} does not exist!\x1b[0m`);
@@ -348,7 +348,7 @@ function transformInline(text) {
const group = getLinkedGroup(ref);
if (group) {
return fixWS`
- ${group.name}
+ ${group.name}
`;
} else {
console.warn(`\x1b[33mThe linked group ${group} does not exist!\x1b[0m`);
@@ -364,7 +364,7 @@ function transformInline(text) {
name = track.name;
}
return fixWS`
- ${name}
+ ${name}
`;
} else {
console.warn(`\x1b[33mThe linked track ${match} does not exist!\x1b[0m`);
@@ -1634,14 +1634,10 @@ async function writePage(directoryParts, {
${Object.entries(meta).filter(([ key, value ]) => value).map(([ key, value ]) => ``).join('\n')}
${canonical && ``}
-
- ${stylesheet && fixWS`
+ ${(theme || stylesheet) && fixWS`
`}
@@ -1675,7 +1671,7 @@ function getGridHTML({
lazy = true
}) {
return entries.map(({ large, item }, i) => fixWS`
-
+
${img({
src: srcFn(item),
alt: altFn(item),
@@ -1865,12 +1861,12 @@ function writeMiscellaneousPages() {
Jump to:
${flashData.filter(act => act.act8r8k && act.jump).map(({ anchor, jump, jumpColor }) => fixWS`
- - ${jump}
+ - ${jump}
`).join('\n')}
${flashData.filter(flash => flash.act8r8k).map((act, i) => fixWS`
-
+
${getFlashGridHTML({
entries: (flashData
@@ -1963,7 +1959,7 @@ function generateCoverLink({
})}
${wikiInfo.features.artTagUI && tags.filter(tag => !tag.isCW).length && `
Tags:
${tags.filter(tag => !tag.isCW).map(tag => fixWS`
- ${tag.name}
+ ${tag.name}
`).join(',\n')}
`}
@@ -1987,7 +1983,7 @@ function writeAlbumPages() {
async function writeAlbumPage(album) {
const trackToListItem = track => fixWS`
-
+
(${getDurationString(track.duration)})
${track.name}
${track.artists !== album.artists && fixWS`
@@ -1999,7 +1995,9 @@ async function writeAlbumPage(album) {
await writePage([C.ALBUM_DIRECTORY, album.directory], {
title: album.name,
stylesheet: getAlbumStylesheet(album),
- theme: `${getThemeString(album)}; --album-directory: ${album.directory}`,
+ theme: getThemeString(album, [
+ `--album-directory: ${album.directory}`
+ ]),
main: {
content: fixWS`
${generateCoverLink({
@@ -2014,7 +2012,7 @@ async function writeAlbumPage(album) {
${album.wallpaperArtists && `Wallpaper art by ${getArtistString(album.wallpaperArtists, true)}.
`}
Released ${getDateString(album)}.
${+album.coverArtDate !== +album.date && `
Art released ${getDateString({date: album.coverArtDate})}.`}
-
Duration: ~${getDurationString(getTotalDuration(album.tracks))}.
+
Duration: ~${getDurationString(getTotalDuration(album.tracks))}.
${album.urls.length && `Listen on ${joinNoOxford(album.urls.map(url => fancifyURL(url, {album: true})), 'or')}.
`}
${album.usesGroups ? fixWS`
@@ -2060,9 +2058,10 @@ async function writeAlbumPage(album) {
}
function getAlbumStylesheet(album) {
- if (album.wallpaperStyle) {
+ if (album.wallpaperArtists) {
return fixWS`
body::before {
+ background-image: url("${C.MEDIA_DIRECTORY}/${C.MEDIA_ALBUM_ART_DIRECTORY}/${album.directory}/bg.jpg");
${album.wallpaperStyle}
}
`;
@@ -2094,7 +2093,7 @@ async function writeTrackPage(track) {
${tracks.map(track => fixWS`
-
- ${track.name}
+ ${track.name}
by ${getArtistString(track.artists)}
${track.aka && `(re-release)`}
@@ -2107,14 +2106,17 @@ async function writeTrackPage(track) {
...otherReleases.map(track =>
(track.commentary?.split('\n')
.filter(line => line.replace(/<\/b>/g, '').includes(':'))
- .flatMap(line => [line, `See ${track.name}!`])
+ .flatMap(line => [line, `See ${track.name}!`])
.join('\n')))
].filter(Boolean).join('\n');
await writePage([C.TRACK_DIRECTORY, track.directory], {
title: track.name,
stylesheet: getAlbumStylesheet(track.album),
- theme: `${getThemeString(track)}; --album-directory: ${album.directory}; --track-directory: ${track.directory}`,
+ theme: getThemeString(track, [
+ `--album-directory: ${album.directory}`,
+ `--track-directory: ${track.directory}`
+ ]),
sidebarLeft: generateSidebarForAlbum(album, track),
sidebarRight: generateSidebarRightForAlbum(album, track),
@@ -2159,8 +2161,8 @@ async function writeTrackPage(track) {
@@ -2198,7 +2200,7 @@ async function writeTrackPage(track) {
-
${getFlashLinkHTML(flash)}
${as !== track && fixWS`
- (as ${as.name})
+ (as ${as.name})
`}
`).join('\n')}
@@ -2258,7 +2260,7 @@ async function writeArtistPage(artist) {
return fixWS`
-
${track.duration && `(${getDurationString(track.duration)})`}
- ${track.name}
+ ${track.name}
${track.artists.some(({ who }) => who === artist) && track.artists.length > 1 && `(with ${getArtistString(track.artists.filter(({ who }) => who !== artist))})`}
${contrib.what && `(${getContributionString(contrib) || 'contributed'})`}
${wikiInfo.features.flashesAndGames && flashes.length && `
(Featured in ${joinNoOxford(flashes.map(flash => getFlashLinkHTML(flash)))})`}
@@ -2320,7 +2322,7 @@ async function writeArtistPage(artist) {
return fixWS`
-
${thing.album ? fixWS`
- ${thing.name}
+ ${thing.name}
` : '(cover art)'}
${thing.coverArtists.length > 1 && `(with ${getArtistString(thing.coverArtists.filter(({ who }) => who !== artist))})`}
${contrib.what && `(${getContributionString(contrib)})`}
@@ -2334,7 +2336,7 @@ async function writeArtistPage(artist) {
const contributionString = flash.contributors.filter(({ who }) => who === artist).map(getContributionString).join(' ');
return fixWS`
-
- ${flash.name}
+ ${flash.name}
${contributionString && `(${contributionString})`}
(${getDateString({date: flash.date})})
@@ -2348,7 +2350,7 @@ async function writeArtistPage(artist) {
return fixWS`
-
${thing.album ? fixWS`
- ${thing.name}
+ ${thing.name}
` : '(album commentary)'}
${wikiInfo.features.flashesAndGames && flashes?.length && `
(Featured in ${joinNoOxford(flashes.map(flash => getFlashLinkHTML(flash)))})`}
@@ -2458,7 +2460,7 @@ function albumChunkedList(tracks, getLI, showDate = true, datePropertyOrFn = 'da
if (i === 0 || album !== getAlbum(previous) || (showDate && +dateFn(thing) !== +dateFn(previous))) {
const heading = fixWS`
-
- ${getAlbum(thing).name}
+ ${getAlbum(thing).name}
${showDate && `(${getDateString({date: dateFn(thing)})})`}
@@ -2486,7 +2488,7 @@ function actChunkedList(flashes, getLI, showDate = true, dateProperty = 'date')
if (i === 0 || act !== previous.act) {
const heading = fixWS`
-
- ${flash.act}
+ ${flash.act}
`;
@@ -2523,7 +2525,9 @@ async function writeFlashPage(flash) {
await writePage([C.FLASH_DIRECTORY, kebab], {
title: flash.name,
- theme: `${getThemeString(flash)}; --flash-directory: ${flash.directory}`,
+ theme: getThemeString(flash, [
+ `--flash-directory: ${flash.directory}`
+ ]),
main: {
content: fixWS`
${flash.name}
@@ -2545,7 +2549,7 @@ async function writeFlashPage(flash) {
${flash.tracks.map(track => fixWS`
-
- ${track.name}
+ ${track.name}
by ${getArtistString(track.artists)}
`).join('\n')}
@@ -2613,18 +2617,18 @@ function generateSidebarForFlashes(flash) {
true
)
).flatMap(({ act, color }) => [
- act.startsWith('Act 1') && `- Side 1 (Acts 1-5)
`
- || act.startsWith('Act 6 Act 1') && `- Side 2 (Acts 6-7)
`
- || act.startsWith('Hiveswap Act 1') && `- Outside Canon (Misc. Games)
`,
+ act.startsWith('Act 1') && `- Side 1 (Acts 1-5)
`
+ || act.startsWith('Act 6 Act 1') && `- Side 2 (Acts 6-7)
`
+ || act.startsWith('Hiveswap Act 1') && `- Outside Canon (Misc. Games)
`,
(
flashData.findIndex(f => f.act === act) < act6 ? side === 1 :
flashData.findIndex(f => f.act === act) < outsideCanon ? side === 2 :
true
- ) && `- ${act}
`,
+ ) && `- ${act}
`,
act === currentAct && fixWS`
${flashData.filter(f => !f.act8r8k && f.act === act).map(f => fixWS`
- - ${f.name}
+ - ${f.name}
`).join('\n')}
`
@@ -2643,7 +2647,7 @@ function writeListingPages() {
const getAlbumLI = (album, extraText = '') => fixWS`
-
- ${album.name}
+ ${album.name}
${extraText}
`;
@@ -2813,16 +2817,16 @@ function writeListingPages() {
.filter(x => x.isGroup)
.sort(sortByName)
.map(group => fixWS`
- - ${group.name}
+ - ${group.name}
`)],
wikiInfo.features.groupUI &&
[['groups', 'by-category'], `Groups - by Category`, fixWS`
${groupData.filter(x => x.isCategory).map(category => fixWS`
- - ${category.name}
+
- ${category.name}
`).join('\n')}
@@ -2834,7 +2838,7 @@ function writeListingPages() {
.map(group => ({group, albums: group.albums.length}))
.sort((a, b) => b.albums - a.albums)
.map(({ group, albums }) => fixWS`
-
- ${group.name} (${s(albums, 'album')})
+ - ${group.name} (${s(albums, 'album')})
`)],
wikiInfo.features.groupUI &&
[['groups', 'by-tracks'], `Groups - by Tracks`, groupData
@@ -2842,7 +2846,7 @@ function writeListingPages() {
.map(group => ({group, tracks: group.albums.reduce((acc, album) => acc + album.tracks.length, 0)}))
.sort((a, b) => b.tracks - a.tracks)
.map(({ group, tracks }) => fixWS`
- - ${group.name} (${s(tracks, 'track')})
+ - ${group.name} (${s(tracks, 'track')})
`)],
wikiInfo.features.groupUI &&
[['groups', 'by-duration'], `Groups - by Duration`, groupData
@@ -2850,7 +2854,7 @@ function writeListingPages() {
.map(group => ({group, duration: getTotalDuration(group.albums.flatMap(album => album.tracks))}))
.sort((a, b) => b.duration - a.duration)
.map(({ group, duration }) => fixWS`
- - ${group.name} (${getDurationString(duration)})
+ - ${group.name} (${getDurationString(duration)})
`)],
wikiInfo.features.groupUI &&
[['groups', 'by-latest'], `Groups - by Latest Album`, C.sortByDate(groupData
@@ -2866,22 +2870,22 @@ function writeListingPages() {
.reverse()
).reverse().map(({ group, date }) => fixWS`
-
- ${group.name}
+ ${group.name}
(${getDateString({date})})
`)],
[['tracks', 'by-name'], `Tracks - by Name`, trackData.slice()
.sort(sortByName)
.map(track => fixWS`
- - ${track.name}
+ - ${track.name}
`)],
[['tracks', 'by-album'], `Tracks - by Album`, fixWS`
${albumData.map(album => fixWS`
- - ${album.name}
+ - ${album.name}
${album.tracks.map(track => fixWS`
- - ${track.name}
+ - ${track.name}
`).join('\n')}
`).join('\n')}
@@ -2890,14 +2894,14 @@ function writeListingPages() {
[['tracks', 'by-date'], `Tracks - by Date`, albumChunkedList(
C.sortByDate(trackData.filter(track => track.album.directory !== C.UNRELEASED_TRACKS_DIRECTORY)),
track => fixWS`
-
- ${track.name} ${track.aka && `(re-release)`}
+ - ${track.name} ${track.aka && `(re-release)`}
`)],
[['tracks', 'by-duration'], `Tracks - by Duration`, C.sortByDate(trackData.slice())
.filter(track => track.duration > 0)
.sort((a, b) => b.duration - a.duration)
.map(track => fixWS`
-
- ${track.name}
+ ${track.name}
(${getDurationString(track.duration)})
`)],
@@ -2909,7 +2913,7 @@ function writeListingPages() {
)),
track => fixWS`
-
- ${track.name}
+ ${track.name}
(${getDurationString(track.duration)})
`,
@@ -2920,26 +2924,26 @@ function writeListingPages() {
.sort((a, b) => b.referencedBy.length - a.referencedBy.length)
.map(track => fixWS`
-
- ${track.name}
+ ${track.name}
(${s(track.referencedBy.length, 'time')} referenced)
`)],
wikiInfo.features.flashesAndGames &&
[['tracks', 'in-flashes', 'by-album'], `Tracks - in Flashes & Games (by Album)`, albumChunkedList(
C.sortByDate(trackData.slice()).filter(track => track.album.directory !== C.UNRELEASED_TRACKS_DIRECTORY && track.flashes.length > 0),
- track => `- ${track.name}
`)],
+ track => `- ${track.name}
`)],
wikiInfo.features.flashesAndGames &&
[['tracks', 'in-flashes', 'by-flash'], `Tracks - in Flashes & Games (by Flash)`, fixWS`
${C.sortByDate(flashData.filter(flash => !flash.act8r8k))
.map(flash => fixWS`
-
- ${flash.name}
+ ${flash.name}
(${getDateString(flash)})
`)
@@ -2950,18 +2954,18 @@ function writeListingPages() {
C.sortByDate(trackData.slice())
.filter(track => track.lyrics),
track => fixWS`
-
- ${track.name}
+ - ${track.name}
`)],
wikiInfo.features.artTagUI &&
[['tags', 'by-name'], 'Tags - by Name', tagData.slice().sort(sortByName)
.filter(tag => !tag.isCW)
- .map(tag => `- ${tag.name}
`)],
+ .map(tag => `- ${tag.name}
`)],
wikiInfo.features.artTagUI &&
[['tags', 'by-uses'], 'Tags - by Uses', tagData.slice().sort(sortByName)
.filter(tag => !tag.isCW)
.map(tag => ({tag, timesUsed: tag.things.length}))
.sort((a, b) => b.timesUsed - a.timesUsed)
- .map(({ tag, timesUsed }) => `- ${tag.name} (${s(timesUsed, 'time')})
`)]
+ .map(({ tag, timesUsed }) => `- ${tag.name} (${s(timesUsed, 'time')})
`)]
].filter(Boolean);
const getWordCount = str => {
@@ -3010,7 +3014,7 @@ function writeListingPages() {
.filter(album => [album, ...album.tracks].some(x => x.commentary))
.map(album => fixWS`
-
- ${album.name}
+ ${album.name}
(${(() => {
const things = [album, ...album.tracks];
const cThings = things.filter(x => x.commentary);
@@ -3027,15 +3031,15 @@ function writeListingPages() {
.map(album => [album, ...album.tracks])
.filter(x => x.some(y => y.commentary))
.map(([ album, ...tracks ]) => fixWS`
-
+
${album.commentary && fixWS`
-
+
${transformMultiline(album.commentary)}
`}
${tracks.filter(t => t.commentary).map(track => fixWS`
-
-
+
+
${transformMultiline(track.commentary)}
`).join('\n')}
@@ -3083,7 +3087,7 @@ function writeListingPages() {
].map(category => fixWS`
- ${category.name}: (Random Album, Random Track)
`).join('\n')}
@@ -3348,16 +3352,6 @@ function getArtistString(artists, showIcons = false) {
}));
}
-/*
-function getThemeString({fg, bg, theme}) {
- return [
- [fg, `--fg-color: ${fg}`],
- [bg, `--bg-color: ${bg}`],
- [theme, `--theme: ${theme + ''}`]
- ].filter(pair => pair[0] !== undefined).map(pair => pair[1]).join('; ');
-}
-*/
-
// Graciously stolen from https://stackoverflow.com/a/54071699! ::::)
// in: r,g,b in [0,1], out: h in [0,360) and s,l in [0,1]
function rgb2hsl(r,g,b) {
@@ -3366,9 +3360,7 @@ function rgb2hsl(r,g,b) {
return [60*(h<0?h+6:h), f ? n/f : 0, (a+a-n)/2];
}
-function getThemeString(thing) {
- const {color} = thing;
-
+function getColorVariables(color) {
const [ r, g, b ] = color.slice(1)
.match(/[0-9a-fA-F]{2,2}/g)
.slice(0, 3)
@@ -3376,27 +3368,29 @@ function getThemeString(thing) {
const [ h, s, l ] = rgb2hsl(r, g, b);
const dim = `hsl(${Math.round(h)}deg, ${Math.round(s * 50)}%, ${Math.round(l * 80)}%)`;
- const album = (
- trackData.includes(thing) ? thing.album :
- albumData.includes(thing) ? thing :
- null
- );
+ return [
+ `--primary-color: ${color}`,
+ `--dim-color: ${dim}`
+ ];
+}
- let bgUrl = '';
- if (album?.wallpaperArtists) {
- // The 8ack-directory (..) here is necessary 8ecause CSS doesn't want
- // to consider the fact that this is, like, not talking a8out a URL
- // relative to the CSS source file. Really, what SHOULD 8e happening
- // here is, we use path.relative to get the URL relative to the HTML
- // file! 8ut I guess that's not what CSS spec says, or whatever.
- // Pretty cringe t8h.
- bgUrl = `../${C.MEDIA_DIRECTORY}/${C.MEDIA_ALBUM_ART_DIRECTORY}/${album.directory}/bg.jpg`;
- }
+function getLinkThemeString(thing) {
+ return getColorVariables(thing.color).join('; ');
+}
- return [
- color && `--fg-color: ${color}; --dim-color: ${dim}`,
- bgUrl && `--bg: url("${bgUrl}")`
- ].filter(Boolean).join('; ');
+function getThemeString(thing, additionalVariables = []) {
+ const variables = [
+ ...getColorVariables(thing.color),
+ ...additionalVariables
+ ].filter(Boolean);
+
+ return fixWS`
+ ${variables.length && fixWS`
+ :root {
+ ${variables.map(line => line + ';').join('\n')}
+ }
+ `}
+ `;
}
function getFlashDirectory(flash) {
@@ -3578,12 +3572,12 @@ function generateSidebarForAlbum(album, currentTrack = null) {
(i > 0 && track.group !== arr[i - 1].group) && `${listTag}>
`,
(i === 0 || track.group !== arr[i - 1].group) && fixWS`
${track.group && fixWS`
- -
+
-
${track.group}
${listTag === 'ol' ? `(${i + 1}–${arr.length - arr.slice().reverse().findIndex(t => t.group === track.group)})` : ``}
`}
- - <${listTag === 'ol' ? `ol start="${i + 1}"` : listTag}>
+
- <${listTag === 'ol' ? `ol start="${i + 1}"` : listTag}>
`,
(!currentTrack || track.group === currentTrack.group) && trackToListItem(track),
i === arr.length && `${listTag}>
`
@@ -3616,8 +3610,8 @@ function generateSidebarRightForAlbum(album, currentTrack = null) {
${!currentTrack && transformMultiline(group.descriptionShort)}
${group.urls.length && `Visit on ${joinNoOxford(group.urls.map(fancifyURL), 'or')}.
`}
${!currentTrack && fixWS`
- ${next && `Next: ${next.name}
`}
- ${previous && `Previous: ${previous.name}
`}
+ ${next && `Next: ${next.name}
`}
+ ${previous && `Previous: ${previous.name}
`}
`}
`)
};
@@ -3636,11 +3630,11 @@ function generateSidebarForGroup(isGallery = false, currentGroup = null) {
${groupData.filter(x => x.isCategory).map(category => [
fixWS`
-
- ${category.name}
+ ${category.name}
${category.groups.map(group => fixWS`
- -
+
-
${group.name}
`).join('\n')}
@@ -3690,7 +3684,7 @@ async function writeGroupPage(group) {
${group.albums.map(album => fixWS`
-
(${album.date.getFullYear()})
- ${album.name}
+ ${album.name}
`).join('\n')}
@@ -3784,7 +3778,7 @@ function getFlashLinkHTML(flash, name = null) {
if (!name) {
name = flash.name;
}
- return `${name}`;
+ return `${name}`;
}
function rebaseURLs(directory, html) {
@@ -3804,6 +3798,14 @@ function rebaseURLs(directory, html) {
url = path.relative(directory, path.join(outputPath, url));
}
return `${attr}="${url}"`;
+ }).replace(/url\("(.*?)"\)/g, (match, url) => {
+ // same as above but for CSS url("...")-style values!
+ try {
+ new URL(url);
+ } catch (error) {
+ url = path.relative(directory, path.join(outputPath, url));
+ }
+ return `url("${url}")`;
});
}
--
cgit 1.3.0-6-gf8a5