« get me outta code hell

content: generateArtistInfoPage: visit links & context notes - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-04 11:57:53 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-04 11:57:53 -0300
commitb542bdb7705684701dffc44ee2beab210c7e4160 (patch)
treeda63dac5422d36b12a3d7ae33e040d2fcf01d4ed /src/content/dependencies
parentc6f9b966adefc46ebd6cc637abf78cb91d1b6ddb (diff)
content: generateArtistInfoPage: visit links & context notes
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateArtistInfoPage.js47
1 files changed, 26 insertions, 21 deletions
diff --git a/src/content/dependencies/generateArtistInfoPage.js b/src/content/dependencies/generateArtistInfoPage.js
index cc19a8d0..a624c12c 100644
--- a/src/content/dependencies/generateArtistInfoPage.js
+++ b/src/content/dependencies/generateArtistInfoPage.js
@@ -14,8 +14,10 @@ export default {
     'linkAlbum',
     'linkArtist',
     'linkArtistGallery',
+    'linkExternal',
     'linkGroup',
     'linkTrack',
+    'transformContent',
   ],
 
   extraDependencies: ['html', 'language'],
@@ -108,6 +110,18 @@ export default {
       return groupInfo;
     };
 
+    if (artist.contextNotes) {
+      const contextNotes = sections.contextNotes = {};
+      contextNotes.content = relation('transformContent', artist.contextNotes);
+    }
+
+    if (!empty(artist.urls)) {
+      const visit = sections.visit = {};
+      visit.externalLinks =
+        artist.urls.map(url =>
+          relation('linkExternal', url));
+    }
+
     const trackContributionEntries = [
       ...artist.tracksAsArtist.map(track => ({
         date: track.date,
@@ -359,6 +373,18 @@ export default {
 
         mainClasses: ['long-content'],
         mainContent: [
+          sec.contextNotes && [
+            html.tag('p', language.$('releaseInfo.note')),
+            html.tag('blockquote',
+              sec.contextNotes.content),
+          ],
+
+          sec.visit &&
+            html.tag('p',
+              language.$('releaseInfo.visitOn', {
+                links: language.formatDisjunctionList(sec.visit.externalLinks),
+              })),
+
           sec.tracks && [
             sec.tracks.heading
               .slots({
@@ -522,8 +548,6 @@ export default {
 export function write(artist, {wikiData}) {
   const {groupData, wikiInfo} = wikiData;
 
-  const {name, urls, contextNotes} = artist;
-
   let flashes, flashListChunks;
   if (wikiInfo.enableFlashesAndGames) {
     flashes = sortChronologically(artist.flashesAsContributor.slice());
@@ -653,25 +677,6 @@ export function write(artist, {wikiData}) {
           headingMode: 'sticky',
 
           content: [
-            ...html.fragment(
-              contextNotes && [
-                html.tag('p',
-                  language.$('releaseInfo.note')),
-
-                html.tag('blockquote',
-                  transformMultiline(contextNotes)),
-
-                html.tag('hr'),
-              ]),
-
-            !empty(urls) &&
-              html.tag('p',
-                language.$('releaseInfo.visitOn', {
-                  links: language.formatDisjunctionList(
-                    urls.map((url) => fancifyURL(url, {language}))
-                  ),
-                })),
-
             hasGallery &&
               html.tag('p',
                 language.$('artistPage.viewArtGallery', {