« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateArtistInfoPage.js19
-rw-r--r--src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js17
-rw-r--r--src/strings-default.yaml3
3 files changed, 33 insertions, 6 deletions
diff --git a/src/content/dependencies/generateArtistInfoPage.js b/src/content/dependencies/generateArtistInfoPage.js
index 81fede4c..860e790d 100644
--- a/src/content/dependencies/generateArtistInfoPage.js
+++ b/src/content/dependencies/generateArtistInfoPage.js
@@ -115,7 +115,10 @@ export default {
       relation('generateArtistInfoPageFlashesChunkedList', artist),
 
     commentaryChunkedList:
-      relation('generateArtistInfoPageCommentaryChunkedList', artist),
+      relation('generateArtistInfoPageCommentaryChunkedList', artist, false),
+
+    wikiEditorCommentaryChunkedList:
+      relation('generateArtistInfoPageCommentaryChunkedList', artist, true),
   }),
 
   data: (query, artist) => ({
@@ -262,7 +265,8 @@ export default {
                       {href: '#flashes'},
                       language.$(pageCapsule, 'flashList.title')),
 
-                  !html.isBlank(relations.commentaryChunkedList) &&
+                  (!html.isBlank(relations.commentaryChunkedList) ||
+                   !html.isBlank(relations.wikiEditorCommentaryChunkedList)) &&
                     html.tag('a',
                       {href: '#commentary'},
                       language.$(pageCapsule, 'commentaryList.title')),
@@ -380,6 +384,17 @@ export default {
               }),
 
             relations.commentaryChunkedList,
+
+            html.tags([
+              html.tag('p',
+                {[html.onlyIfSiblings]: true},
+
+                language.$(pageCapsule, 'wikiEditorCommentary', {
+                  artist: data.name,
+                })),
+
+              relations.wikiEditorCommentaryChunkedList,
+            ]),
           ]),
         ],
 
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),
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index c63faeb5..9a2b26b7 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -1247,6 +1247,9 @@ artistPage:
   wikiEditArtworks: >-
     {ARTIST} has edited these artworks for this wiki:
 
+  wikiEditorCommentary: >-
+    {ARTIST} has written these commentary entries as an editor of this wiki:
+
 #
 # artistGalleryPage:
 #   The artist gallery page shows a neat grid of all of the album and