From b82bbd5e5ee13cdfc0c2dbdb7ed8f6ba8ff6e962 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 4 Feb 2025 13:36:38 -0400 Subject: content: generateArtistInfoPage: wiki editor commentary list --- .../generateArtistInfoPageCommentaryChunkedList.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js') diff --git a/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js b/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js index 711db34b..6c619f3c 100644 --- a/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js +++ b/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js @@ -19,7 +19,7 @@ export default { extraDependencies: ['html', 'language'], - query(artist) { + query(artist, filterWikiEditorCommentary) { const processEntry = ({ thing, entry, @@ -87,6 +87,12 @@ export default { .flatMap(thing => thing.commentary .filter(entry => entry.artists.includes(artist)) + + .filter(({annotation}) => + (filterWikiEditorCommentary + ? annotation?.startsWith(`wiki editor`) + : !annotation?.startsWith(`wiki editor`))) + .map(entry => processEntry({thing, entry}))); const processAlbumEntries = ({albums}) => @@ -146,7 +152,7 @@ export default { return {chunks}; }, - relations: (relation, query) => ({ + relations: (relation, query, _artist, filterWikiEditorCommentary) => ({ chunks: query.chunks .map(() => relation('generateArtistInfoPageChunk')), @@ -179,10 +185,13 @@ export default { query.chunks .map(({chunk}) => chunk .map(({annotation}) => - relation('transformContent', annotation))), + relation('transformContent', + (filterWikiEditorCommentary + ? annotation?.replace(/^wiki editor(, )?/, '') + : annotation)))), }), - data: (query) => ({ + data: (query, _artist, _filterWikiEditorCommentary) => ({ chunkTypes: query.chunks .map(({chunkType}) => chunkType), -- cgit 1.3.0-6-gf8a5