« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/generateArtistInfoPage.js47
-rw-r--r--src/strings-default.json2
2 files changed, 27 insertions, 22 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', {
diff --git a/src/strings-default.json b/src/strings-default.json
index 6171943c..345f20ff 100644
--- a/src/strings-default.json
+++ b/src/strings-default.json
@@ -138,7 +138,7 @@
   "releaseInfo.midiProjectFiles.shortcut": "Download {LINK}.",
   "releaseInfo.midiProjectFiles.shortcut.link": "MIDI/project files",
   "releaseInfo.midiProjectFiles.heading": "Download MIDI/project files:",
-  "releaseInfo.note": "Note:",
+  "releaseInfo.note": "Context notes:",
   "trackList.section.withDuration": "{SECTION} ({DURATION}):",
   "trackList.group": "From {GROUP}:",
   "trackList.group.fromOther": "From somewhere else:",