diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-10-14 12:02:49 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-10-14 12:02:49 -0300 |
commit | ecc56837c381af86d06a5bb1bd0c6190b8d6013c (patch) | |
tree | 45ff072e51928420fbd8f83ab6cc16ce27e1f051 /src/content | |
parent | 41f0d592571f7066e785f9a4598fa48e26f1c0a0 (diff) |
content: gAIP{Chunk,ChunkItem,Artworks*}: layer trimming higher
This basically reverts commit 53794015 (which introduced the trimAnnotation slot). Behavior is pulled out of gAIPChunkItem and into gAIPArtworksChunkItem, with slots similarly shuffled around.
Diffstat (limited to 'src/content')
5 files changed, 40 insertions, 37 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageArtworksChunk.js b/src/content/dependencies/generateArtistInfoPageArtworksChunk.js index 2b10df3e..66e4204a 100644 --- a/src/content/dependencies/generateArtistInfoPageArtworksChunk.js +++ b/src/content/dependencies/generateArtistInfoPageArtworksChunk.js @@ -5,6 +5,8 @@ export default { 'linkAlbum', ], + extraDependencies: ['html'], + relations: (relation, album, contribs) => ({ template: relation('generateArtistInfoPageChunk'), @@ -24,11 +26,25 @@ export default { .map(contrib => contrib.date), }), - generate: (data, relations) => + slots: { + filterEditsForWiki: { + type: 'boolean', + default: false, + }, + }, + + generate: (data, relations, slots) => relations.template.slots({ mode: 'album', albumLink: relations.albumLink, - dates: data.dates, - items: relations.items, + + dates: + (slots.filterEditsForWiki + ? Array.from({length: data.dates}, () => null) + : data.dates), + + items: + relations.items.map(item => + item.slot('filterEditsForWiki', slots.filterEditsForWiki)), }), }; diff --git a/src/content/dependencies/generateArtistInfoPageArtworksChunkItem.js b/src/content/dependencies/generateArtistInfoPageArtworksChunkItem.js index e8d887b1..089cfb8d 100644 --- a/src/content/dependencies/generateArtistInfoPageArtworksChunkItem.js +++ b/src/content/dependencies/generateArtistInfoPageArtworksChunkItem.js @@ -39,11 +39,21 @@ export default { contrib.annotation, }), - generate: (data, relations, {html, language}) => + slots: { + filterEditsForWiki: { + type: 'boolean', + default: false, + }, + }, + + generate: (data, relations, slots, {html, language}) => relations.template.slots({ otherArtistLinks: relations.otherArtistLinks, - annotation: data.annotation, + annotation: + (slots.filterEditsForWiki + ? data.annotation?.replace(/^edits for wiki(: )?/, '') + : data.annotation), content: language.encapsulate('artistPage.creditList.entry', capsule => diff --git a/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js b/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js index 2be02577..8b024147 100644 --- a/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js +++ b/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js @@ -65,15 +65,7 @@ export default { generate: (data, relations) => relations.chunkedList.slots({ chunks: - relations.chunks.map(chunk => { - if (data.filterEditsForWiki) { - chunk.setSlots({ - trimAnnotations: true, - dates: [], - }); - } - - return chunk; - }), + relations.chunks.map(chunk => + chunk.slot('filterEditsForWiki', data.filterEditsForWiki)), }), }; diff --git a/src/content/dependencies/generateArtistInfoPageChunk.js b/src/content/dependencies/generateArtistInfoPageChunk.js index 820c01e0..c16d50f3 100644 --- a/src/content/dependencies/generateArtistInfoPageChunk.js +++ b/src/content/dependencies/generateArtistInfoPageChunk.js @@ -29,11 +29,6 @@ export default { duration: {validate: v => v.isDuration}, durationApproximate: {type: 'boolean'}, - - trimAnnotations: { - type: 'boolean', - default: false, - }, }, generate(slots, {html, language}) { @@ -107,10 +102,7 @@ export default { html.tag('dt', accentedLink), html.tag('dd', html.tag('ul', - slots.items - .map(item => item.slots({ - trimAnnotation: slots.trimAnnotations, - })))), + slots.items)), ]); }, }; diff --git a/src/content/dependencies/generateArtistInfoPageChunkItem.js b/src/content/dependencies/generateArtistInfoPageChunkItem.js index 0ec7b1ec..9d406c67 100644 --- a/src/content/dependencies/generateArtistInfoPageChunkItem.js +++ b/src/content/dependencies/generateArtistInfoPageChunkItem.js @@ -9,18 +9,16 @@ export default { mutable: false, }, - annotation: {type: 'string'}, + annotation: { + type: 'html', + mutable: false, + }, otherArtistLinks: { validate: v => v.strictArrayOf(v.isHTML), }, rerelease: {type: 'boolean'}, - - trimAnnotation: { - type: 'boolean', - default: false, - }, }, generate: (slots, {html, language}) => @@ -45,15 +43,10 @@ export default { language.formatConjunctionList(slots.otherArtistLinks); } - const annotation = - (slots.trimAnnotation - ? slots.annotation?.replace(/^edits for wiki(: )?/, '') - : slots.annotation); - - if (annotation) { + if (!html.isBlank(slots.annotation)) { anyAccent = true; workingCapsule += '.withAnnotation'; - workingOptions.annotation = annotation; + workingOptions.annotation = slots.annotation; } if (anyAccent) { |