« get me outta code hell

content: generate{Artist,Group}InfoPage: alias links - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-11-17 10:06:28 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-11-17 13:40:01 -0400
commit1b38561fa4fda4ef314d3db035812c35976487fe (patch)
tree232b42f3d80daa087fee4ae4600610ddc44de5d3 /src
parent0d74914e3c3c345ddac3025b561b88ed9a055f95 (diff)
content: generate{Artist,Group}InfoPage: alias links
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateArtistInfoPage.js87
-rw-r--r--src/content/dependencies/generateGroupInfoPage.js109
-rw-r--r--src/strings-default.yaml4
3 files changed, 130 insertions, 70 deletions
diff --git a/src/content/dependencies/generateArtistInfoPage.js b/src/content/dependencies/generateArtistInfoPage.js
index 7b47c037..e969de8d 100644
--- a/src/content/dependencies/generateArtistInfoPage.js
+++ b/src/content/dependencies/generateArtistInfoPage.js
@@ -49,6 +49,16 @@ export default {
     hasGallery:
       !empty(artist.albumCoverArtistContributions) ||
       !empty(artist.trackCoverArtistContributions),
+
+    aliasLinkedGroups:
+      artist.closelyLinkedGroups
+        .filter(({annotation}) =>
+          annotation === 'alias'),
+
+    generalLinkedGroups:
+      artist.closelyLinkedGroups
+        .filter(({annotation}) =>
+          annotation !== 'alias'),
   }),
 
   relations: (relation, query, artist) => ({
@@ -70,7 +80,12 @@ export default {
       relation('transformContent', artist.contextNotes),
 
     closeGroupLinks:
-      artist.closelyLinkedGroups
+      query.generalLinkedGroups
+        .map(({thing: group}) =>
+          relation('linkGroup', group)),
+
+    aliasGroupLinks:
+      query.aliasLinkedGroups
         .map(({thing: group}) =>
           relation('linkGroup', group)),
 
@@ -118,7 +133,7 @@ export default {
         : null),
 
     closeGroupAnnotations:
-      artist.closelyLinkedGroups
+      query.generalLinkedGroups
         .map(({annotation}) => annotation),
 
     totalTrackCount:
@@ -158,36 +173,46 @@ export default {
 
           html.tag('p',
             {[html.onlyIfContent]: true},
+            {[html.joinChildren]: html.tag('br')},
+
+            language.encapsulate(pageCapsule, 'closelyLinkedGroups', capsule => [
+              language.encapsulate(capsule, capsule => {
+                const [workingCapsule, option] =
+                  (relations.closeGroupLinks.length === 0
+                    ? [null, null]
+                 : relations.closeGroupLinks.length === 1
+                    ? [language.encapsulate(capsule, 'one'), 'group']
+                    : [language.encapsulate(capsule, 'multiple'), 'groups']);
+
+                if (!workingCapsule) return html.blank();
+
+                return language.$(workingCapsule, {
+                  [option]:
+                    language.formatUnitList(
+                      stitchArrays({
+                        link: relations.closeGroupLinks,
+                        annotation: data.closeGroupAnnotations,
+                      }).map(({link, annotation}) =>
+                          language.encapsulate(capsule, 'group', workingCapsule => {
+                            const workingOptions = {group: link};
+
+                            if (annotation) {
+                              workingCapsule += '.withAnnotation';
+                              workingOptions.annotation = annotation;
+                            }
+
+                            return language.$(workingCapsule, workingOptions);
+                          }))),
+                });
+              }),
 
-            language.encapsulate(pageCapsule, 'closelyLinkedGroups', capsule => {
-              const [workingCapsule, option] =
-                (relations.closeGroupLinks.length === 0
-                  ? [null, null]
-               : relations.closeGroupLinks.length === 1
-                  ? [language.encapsulate(capsule, 'one'), 'group']
-                  : [language.encapsulate(capsule, 'multiple'), 'groups']);
-
-              if (!workingCapsule) return html.blank();
-
-              return language.$(workingCapsule, {
-                [option]:
-                  language.formatUnitList(
-                    stitchArrays({
-                      link: relations.closeGroupLinks,
-                      annotation: data.closeGroupAnnotations,
-                    }).map(({link, annotation}) =>
-                        language.encapsulate(capsule, 'group', workingCapsule => {
-                          const workingOptions = {group: link};
-
-                          if (annotation) {
-                            workingCapsule += '.withAnnotation';
-                            workingOptions.annotation = annotation;
-                          }
-
-                          return language.$(workingCapsule, workingOptions);
-                        }))),
-              });
-            })),
+              language.$(capsule, 'alias', {
+                [language.onlyIfOptions]: ['groups'],
+
+                groups:
+                  language.formatConjunctionList(relations.aliasGroupLinks),
+              }),
+            ])),
 
           html.tag('p',
             {[html.onlyIfContent]: true},
diff --git a/src/content/dependencies/generateGroupInfoPage.js b/src/content/dependencies/generateGroupInfoPage.js
index 918d6476..90cbb970 100644
--- a/src/content/dependencies/generateGroupInfoPage.js
+++ b/src/content/dependencies/generateGroupInfoPage.js
@@ -23,7 +23,19 @@ export default {
       wikiInfo.color,
   }),
 
-  relations: (relation, sprawl, group) => ({
+  query: (_sprawl, group) => ({
+    aliasLinkedArtists:
+      group.closelyLinkedArtists
+        .filter(({annotation}) =>
+          annotation === 'alias'),
+
+    generalLinkedArtists:
+      group.closelyLinkedArtists
+        .filter(({annotation}) =>
+          annotation !== 'alias'),
+  }),
+
+  relations: (relation, query, sprawl, group) => ({
     layout:
       relation('generatePageLayout'),
 
@@ -44,7 +56,12 @@ export default {
       relation('generateColorStyleAttribute', sprawl.wikiColor),
 
     closeArtistLinks:
-      group.closelyLinkedArtists
+      query.generalLinkedArtists
+        .map(({thing: artist}) =>
+          relation('linkArtist', artist)),
+
+    aliasArtistLinks:
+      query.aliasLinkedArtists
         .map(({thing: artist}) =>
           relation('linkArtist', artist)),
 
@@ -59,7 +76,7 @@ export default {
       relation('generateGroupInfoPageAlbumsSection', group),
   }),
 
-  data: (_sprawl, group) => ({
+  data: (query, _sprawl, group) => ({
     name:
       group.name,
 
@@ -67,7 +84,7 @@ export default {
       group.color,
 
     closeArtistAnnotations:
-      group.closelyLinkedArtists
+      query.generalLinkedArtists
         .map(({annotation}) => annotation),
   }),
 
@@ -81,41 +98,55 @@ export default {
         mainContent: [
           html.tag('p',
             {[html.onlyIfContent]: true},
-
-            language.encapsulate(pageCapsule, 'closelyLinkedArtists', capsule => {
-              const [workingCapsule, option] =
-                (relations.closeArtistLinks.length === 0
-                  ? [null, null]
-               : relations.closeArtistLinks.length === 1
-                  ? [language.encapsulate(capsule, 'one'), 'artist']
-                  : [language.encapsulate(capsule, 'multiple'), 'artists']);
-
-              if (!workingCapsule) return html.blank();
-
-              return language.$(workingCapsule, {
-                [option]:
-                  language.formatUnitList(
-                    stitchArrays({
-                      link: relations.closeArtistLinks,
-                      annotation: data.closeArtistAnnotations,
-                    }).map(({link, annotation}) =>
-                        language.encapsulate(capsule, 'artist', workingCapsule => {
-                          const workingOptions = {};
-
-                          workingOptions.artist =
-                            link.slots({
-                              attributes: [relations.wikiColorAttribute],
-                            });
-
-                          if (annotation) {
-                            workingCapsule += '.withAnnotation';
-                            workingOptions.annotation = annotation;
-                          }
-
-                          return language.$(workingCapsule, workingOptions);
-                        }))),
-              });
-            })),
+            {[html.joinChildren]: html.tag('br')},
+
+            language.encapsulate(pageCapsule, 'closelyLinkedArtists', capsule => [
+              language.encapsulate(capsule, capsule => {
+                const [workingCapsule, option] =
+                  (relations.closeArtistLinks.length === 0
+                    ? [null, null]
+                 : relations.closeArtistLinks.length === 1
+                    ? [language.encapsulate(capsule, 'one'), 'artist']
+                    : [language.encapsulate(capsule, 'multiple'), 'artists']);
+
+                if (!workingCapsule) return html.blank();
+
+                return language.$(workingCapsule, {
+                  [option]:
+                    language.formatUnitList(
+                      stitchArrays({
+                        link: relations.closeArtistLinks,
+                        annotation: data.closeArtistAnnotations,
+                      }).map(({link, annotation}) =>
+                          language.encapsulate(capsule, 'artist', workingCapsule => {
+                            const workingOptions = {};
+
+                            workingOptions.artist =
+                              link.slots({
+                                attributes: [relations.wikiColorAttribute],
+                              });
+
+                            if (annotation) {
+                              workingCapsule += '.withAnnotation';
+                              workingOptions.annotation = annotation;
+                            }
+
+                            return language.$(workingCapsule, workingOptions);
+                          }))),
+                });
+              }),
+
+              language.$(capsule, 'aliases', {
+                [language.onlyIfOptions]: ['aliases'],
+
+                aliases:
+                  language.formatConjunctionList(
+                    relations.aliasArtistLinks.map(link =>
+                      link.slots({
+                        attributes: [relations.wikiColorAttribute],
+                      }))),
+              }),
+            ])),
 
           html.tag('p',
             {[html.onlyIfContent]: true},
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index f6c21c72..5f82a1a1 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -1081,6 +1081,8 @@ artistPage:
       _: "{GROUP}"
       withAnnotation: "{GROUP} ({ANNOTATION})"
 
+    alias: "This artist is an alias of {GROUPS}."
+
   creditList:
 
     # album:
@@ -1318,6 +1320,8 @@ groupInfoPage:
     one: "View artist page: {ARTIST}."
     multiple: "View artist pages: {ARTISTS}."
 
+    aliases: "View alias pages: {ALIASES}."
+
     artist:
       _: "{ARTIST}"
       withAnnotation: "{ARTIST} ({ANNOTATION})"