From 154470c2a71eea2b68f1c029bc6db0230217680d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 5 Jan 2023 20:10:51 -0400 Subject: fix threshold requirement for lazy loading --- src/static/lazy-loading.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/static/lazy-loading.js b/src/static/lazy-loading.js index b04ad7c2..1df56f08 100644 --- a/src/static/lazy-loading.js +++ b/src/static/lazy-loading.js @@ -37,7 +37,7 @@ function lazyLoadMain() { if (window.IntersectionObserver) { observer = new IntersectionObserver(lazyLoad, { rootMargin: '200px', - threshold: 1.0, + threshold: 0, }); for (i = 0; i < lazyElements.length; i++) { observer.observe(lazyElements[i]); -- cgit 1.3.0-6-gf8a5 From 2f129a9ca167c5fecf303234c7e2bb5ea347f1c2 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 15 Jan 2023 16:00:03 -0400 Subject: change tracks/by-date sorting algorithm --- src/listing-spec.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/listing-spec.js b/src/listing-spec.js index 636e5f67..05abbd05 100644 --- a/src/listing-spec.js +++ b/src/listing-spec.js @@ -615,9 +615,12 @@ const listingSpec = [ directory: 'tracks/by-date', stringsKey: 'listTracks.byDate', - data: ({wikiData: {trackData}}) => + data: ({wikiData: {albumData}}) => chunkByProperties( - sortChronologically(trackData.filter(t => t.date)), + sortByDate( + sortChronologically(albumData) + .flatMap(album => album.tracks) + .filter(track => track.date)), ['album', 'date']), html: (data, {html, language, link}) => -- cgit 1.3.0-6-gf8a5 From 4afee4aa8b8af89fcc00bcabaf6cf02176eb77da Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 15 Jan 2023 15:59:10 -0400 Subject: fix tracks/by-date missing rerelease accent --- src/listing-spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/listing-spec.js b/src/listing-spec.js index 05abbd05..26910c05 100644 --- a/src/listing-spec.js +++ b/src/listing-spec.js @@ -635,7 +635,7 @@ const listingSpec = [ html.tag('dd', html.tag('ul', tracks.map(track => - track.aka + track.originalReleaseTrack ? html.tag('li', {class: 'rerelease'}, language.$('listingPage.listTracks.byDate.track.rerelease', { -- cgit 1.3.0-6-gf8a5 From 13c70bcce020dd2768eb2ed10d724cdaa276326a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 15 Jan 2023 16:35:26 -0400 Subject: preserve h2 class when stickyalizing it --- src/upd8.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/upd8.js b/src/upd8.js index 920f9039..a793feb6 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -572,8 +572,14 @@ function transformMultiline(text, { } // for sticky headings! - if (elementMatch) { - lineContent = lineContent.replace(/

/g, (match, attributes) => { + const parsedAttributes = parseAttributes(attributes, {to}); + return `

`; + }); } } -- cgit 1.3.0-6-gf8a5 From a526ae6ac12e912374ff812c0ab89c70c7943df7 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 15 Jan 2023 15:41:22 -0400 Subject: be more resilient handling empty YAML documents --- src/data/yaml.js | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/data/yaml.js b/src/data/yaml.js index 02e56d64..b00d68ee 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -968,7 +968,7 @@ export async function loadAndProcessDataDocuments({dataPath}) { }); } else { const {result, aggregate} = mapAggregate( - yamlResult, + yamlResult.filter(Boolean), decorateErrorWithIndex(dataStep.processDocument), {message: `Errors processing documents`}); processResults = result; @@ -994,7 +994,7 @@ export async function loadAndProcessDataDocuments({dataPath}) { typeof dataStep.files === 'function' ? await callAsync(dataStep.files, dataPath) : dataStep.files - ) + ); if (!files) { return; @@ -1005,8 +1005,7 @@ export async function loadAndProcessDataDocuments({dataPath}) { const readResults = await mapAsync( files, (file) => readFile(file, 'utf-8').then((contents) => ({file, contents})), - {message: `Errors reading data files`} - ); + {message: `Errors reading data files`}); const yamlResults = map( readResults, @@ -1014,8 +1013,7 @@ export async function loadAndProcessDataDocuments({dataPath}) { file, documents: yaml.loadAll(contents), })), - {message: `Errors parsing data files as valid YAML`} - ); + {message: `Errors parsing data files as valid YAML`}); let processResults; @@ -1026,12 +1024,17 @@ export async function loadAndProcessDataDocuments({dataPath}) { yamlResults.forEach(({file, documents}) => { const [headerDocument, ...entryDocuments] = documents; + if (!headerDocument) { + call(decorateErrorWithFile(() => { + throw new Error(`Missing header document (empty file or erroneously starting with "---"?)`); + }), {file}); + return; + } + const header = call( decorateErrorWithFile(({document}) => - dataStep.processHeaderDocument(document) - ), - {file, document: headerDocument} - ); + dataStep.processHeaderDocument(document)), + {file, document: headerDocument}); // Don't continue processing files whose header // document is invalid - the entire file is excempt @@ -1041,14 +1044,13 @@ export async function loadAndProcessDataDocuments({dataPath}) { } const entries = map( - entryDocuments.map((document) => ({file, document})), + entryDocuments + .filter(Boolean) + .map((document) => ({file, document})), decorateErrorWithFile( decorateErrorWithIndex(({document}) => - dataStep.processEntryDocument(document) - ) - ), - {message: `Errors processing entry documents`} - ); + dataStep.processEntryDocument(document))), + {message: `Errors processing entry documents`}); // Entries may be incomplete (i.e. any errored // documents won't have a processed output @@ -1066,22 +1068,20 @@ export async function loadAndProcessDataDocuments({dataPath}) { yamlResults.forEach(({file, documents}) => { if (documents.length > 1) { - call( - decorateErrorWithFile(() => { - throw new Error( - `Only expected one document to be present per file` - ); - }) - ); + call(decorateErrorWithFile(() => { + throw new Error(`Only expected one document to be present per file`); + }), {file}); return; + } else if (empty(documents) || !documents[0]) { + call(decorateErrorWithFile(() => { + throw new Error(`Expected a document, this file is empty`); + }), {file}); } const result = call( decorateErrorWithFile(({document}) => - dataStep.processDocument(document) - ), - {file, document: documents[0]} - ); + dataStep.processDocument(document)), + {file, document: documents[0]}); if (!result) { return; -- cgit 1.3.0-6-gf8a5