« 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/generatePageLayout.js1
-rw-r--r--src/content/dependencies/generateTrackInfoPage.js23
-rw-r--r--src/data/checks.js2
-rw-r--r--src/data/things/album.js3
-rw-r--r--src/data/things/content.js2
-rw-r--r--src/data/things/track.js11
-rw-r--r--src/data/yaml.js6
-rw-r--r--src/strings-default.yaml8
8 files changed, 56 insertions, 0 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index 07753af0..f6158e7f 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -582,6 +582,7 @@ export default {
               {id: 'commentary', string: 'commentary'},
               {id: 'artist-commentary', string: 'artistCommentary'},
               {id: 'crediting-sources', string: 'creditingSources'},
+              {id: 'referencing-sources', string: 'referencingSources'},
             ])),
         ]);
 
diff --git a/src/content/dependencies/generateTrackInfoPage.js b/src/content/dependencies/generateTrackInfoPage.js
index afe4979e..1411406e 100644
--- a/src/content/dependencies/generateTrackInfoPage.js
+++ b/src/content/dependencies/generateTrackInfoPage.js
@@ -109,6 +109,10 @@ export default {
     creditingSourceEntries:
       track.creditingSources
         .map(entry => relation('generateCommentaryEntry', entry)),
+
+    referencingSourceEntries:
+      track.referencingSources
+        .map(entry => relation('generateCommentaryEntry', entry)),
   }),
 
   data: (_query, track) => ({
@@ -189,6 +193,15 @@ export default {
                         {href: '#crediting-sources'},
                         language.$(capsule, 'link')),
                   })),
+
+              !html.isBlank(relations.referencingSourceEntries) &&
+                language.encapsulate(capsule, 'readReferencingSources', capsule =>
+                  language.$(capsule, {
+                    link:
+                      html.tag('a',
+                        {href: '#referencing-sources'},
+                        language.$(capsule, 'link')),
+                  })),
             ])),
 
           relations.otherReleasesList,
@@ -346,6 +359,16 @@ export default {
 
             relations.creditingSourceEntries,
           ]),
+
+          html.tags([
+            relations.contentHeading.clone()
+              .slots({
+                attributes: {id: 'referencing-sources'},
+                title: language.$('misc.referencingSources'),
+              }),
+
+            relations.referencingSourceEntries,
+          ]),
         ],
 
         navLinkStyle: 'hierarchical',
diff --git a/src/data/checks.js b/src/data/checks.js
index 582b4eb4..c86d895d 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -236,6 +236,7 @@ export function filterReferenceErrors(wikiData, {
       mainReleaseTrack: '_trackMainReleasesOnly',
       commentary: '_content',
       creditingSources: '_content',
+      referencingSources: '_content',
       lyrics: '_content',
     }],
 
@@ -612,6 +613,7 @@ export function reportContentTextErrors(wikiData, {
       additionalFiles: additionalFileShape,
       commentary: commentaryShape,
       creditingSources: commentaryShape,
+      referencingSources: commentaryShape,
       lyrics: lyricsShape,
       midiProjectFiles: additionalFileShape,
       sheetMusicFiles: additionalFileShape,
diff --git a/src/data/things/album.js b/src/data/things/album.js
index dc31bb10..b1aad9fc 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -696,6 +696,7 @@ export class Album extends Thing {
       const artworkData = [];
       const commentaryData = [];
       const creditingSourceData = [];
+      const referencingSourceData = [];
       const lyricsData = [];
 
       for (const {header: album, entries} of results) {
@@ -745,6 +746,7 @@ export class Album extends Thing {
           artworkData.push(...entry.trackArtworks);
           commentaryData.push(...entry.commentary);
           creditingSourceData.push(...entry.creditingSources);
+          referencingSourceData.push(...entry.referencingSources);
 
           // TODO: As exposed, Track.lyrics tries to inherit from the main
           // release, which is impossible before the data's been linked.
@@ -780,6 +782,7 @@ export class Album extends Thing {
         artworkData,
         commentaryData,
         creditingSourceData,
+        referencingSourceData,
         lyricsData,
       };
     },
diff --git a/src/data/things/content.js b/src/data/things/content.js
index cf8fa1f4..fbc2e417 100644
--- a/src/data/things/content.js
+++ b/src/data/things/content.js
@@ -188,3 +188,5 @@ export class LyricsEntry extends ContentEntry {
 }
 
 export class CreditingSourcesEntry extends ContentEntry {}
+
+export class ReferencingSourcesEntry extends ContentEntry {}
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 5da1e00a..ba21cda1 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -15,6 +15,7 @@ import {
   parseCommentary,
   parseContributors,
   parseCreditingSources,
+  parseReferencingSources,
   parseDate,
   parseDimensions,
   parseDuration,
@@ -93,6 +94,7 @@ export class Track extends Thing {
     CreditingSourcesEntry,
     Flash,
     LyricsEntry,
+    ReferencingSourcesEntry,
     TrackSection,
     WikiInfo,
   }) => ({
@@ -231,6 +233,10 @@ export class Track extends Thing {
       class: input.value(CreditingSourcesEntry),
     }),
 
+    referencingSources: thingList({
+      class: input.value(ReferencingSourcesEntry),
+    }),
+
     lyrics: [
       // TODO: Inherited lyrics are literally the same objects, so of course
       // their .thing properties aren't going to point back to this one, and
@@ -522,6 +528,11 @@ export class Track extends Thing {
         transform: parseCreditingSources,
       },
 
+      'Referencing Sources': {
+        property: 'referencingSources',
+        transform: parseReferencingSources,
+      },
+
       'Additional Files': {
         property: 'additionalFiles',
         transform: parseAdditionalFiles,
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 2dd1f7e8..e8d24353 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -930,6 +930,10 @@ export function parseCreditingSources(value, {subdoc, CreditingSourcesEntry}) {
   return parseContentEntries(CreditingSourcesEntry, value, {subdoc});
 }
 
+export function parseReferencingSources(value, {subdoc, ReferencingSourcesEntry}) {
+  return parseContentEntries(ReferencingSourcesEntry, value, {subdoc});
+}
+
 export function parseLyrics(value, {subdoc, LyricsEntry}) {
   if (
     typeof value === 'string' &&
@@ -1638,6 +1642,8 @@ export function linkWikiDataArrays(wikiData, {bindFind, bindReverse}) {
 
     ['lyricsData', [/* find */]],
 
+    ['referencingSourceData', [/* find */]],
+
     ['seriesData', [/* find */]],
 
     ['trackData', [
diff --git a/src/strings-default.yaml b/src/strings-default.yaml
index 002bdb72..0ce33a2c 100644
--- a/src/strings-default.yaml
+++ b/src/strings-default.yaml
@@ -374,6 +374,10 @@ releaseInfo:
     _: "Read {LINK}."
     link: "crediting sources"
 
+  readReferencingSources:
+    _: "Read {LINK}."
+    link: "referencing sources"
+
   additionalFiles:
     heading: "View or download additional files:"
 
@@ -838,6 +842,9 @@ misc:
       group: "Groups"
       track: "Tracks"
 
+  referencingSources:
+    _: "Referencing sources:"
+
   # skippers:
   #
   #   These are navigational links that only show up when you're
@@ -886,6 +893,7 @@ misc:
     sampledBy: "Sampled by..."
     features: "Features..."
     featuredIn: "Featured in..."
+    referencingSources: "Referencing sources"
 
     lyrics: "Lyrics"