« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'src/content')
-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', {