« 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/generateListAllAdditionalFilesChunk.js6
-rw-r--r--src/content/dependencies/transformContent.js5
-rw-r--r--src/data/things/Language.js47
-rw-r--r--src/urls-default.yaml2
4 files changed, 40 insertions, 20 deletions
diff --git a/src/content/dependencies/generateListAllAdditionalFilesChunk.js b/src/content/dependencies/generateListAllAdditionalFilesChunk.js
index dff652f6..ddbaa69d 100644
--- a/src/content/dependencies/generateListAllAdditionalFilesChunk.js
+++ b/src/content/dependencies/generateListAllAdditionalFilesChunk.js
@@ -67,9 +67,9 @@ export default {
                           : language.$(capsule, 'placeholderTitle'));
 
                       workingOptions.title =
-                        (links.length <= 1
-                          ? links[0].slot('content', titlePart)
-                          : html.tag('b', titlePart));
+                        (links.length === 0 ? titlePart
+                       : links.length === 1 ? links[0].slot('content', titlePart)
+                                            : html.tag('b', titlePart));
 
                       artistCredit.setSlots({
                         normalStringKey: capsule + '.credit',
diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js
index 62a547e4..b2d878ac 100644
--- a/src/content/dependencies/transformContent.js
+++ b/src/content/dependencies/transformContent.js
@@ -465,13 +465,10 @@ export default {
                     {title:
                       language.encapsulate('misc.external.opensInNewTab', capsule =>
                         language.$(capsule, {
-                          link:
+                          platform:
                             language.formatExternalLink(link, {
                               style: 'platform',
                             }),
-
-                          annotation:
-                            language.$(capsule, 'annotation'),
                         }).toString())},
 
                     content);
diff --git a/src/data/things/Language.js b/src/data/things/Language.js
index dc8c0368..8b8c78b7 100644
--- a/src/data/things/Language.js
+++ b/src/data/things/Language.js
@@ -732,31 +732,49 @@ export class Language extends Thing {
       : duration;
   }
 
-  formatExternalLink(url, {
+  formatExternalLink(urlEntry, {
     style = 'platform',
     context = 'generic',
   } = {}) {
     // Null or undefined url is blank content.
-    if (url === null || url === undefined) {
+    if (urlEntry === null || urlEntry === undefined) {
       return html.blank();
     }
 
+    // String means we're probably receiving a URL, not a URL entry.
+    // Just fill in blanks like from a mock/dummy entry.
+    if (typeof urlEntry === 'string') {
+      return this.formatExternalLink(
+        {
+          url: urlEntry,
+          annotation: null,
+        },
+        {style, context});
+    }
+
     isExternalLinkContext(context);
 
     if (style === 'all') {
-      return getExternalLinkStringsFromDescriptors(url, externalLinkSpec, {
-        language: this,
-        context,
-      });
+      return getExternalLinkStringsFromDescriptors(
+        urlEntry,
+        externalLinkSpec,
+        {
+          language: this,
+          context,
+        });
     }
 
     isExternalLinkStyle(style);
 
     const result =
-      getExternalLinkStringOfStyleFromDescriptors(url, style, externalLinkSpec, {
-        language: this,
-        context,
-      });
+      getExternalLinkStringOfStyleFromDescriptors(
+        urlEntry,
+        style,
+        externalLinkSpec,
+        {
+          language: this,
+          context,
+        });
 
     // It's possible for there to not actually be any string available for the
     // given URL, style, and context, and we want this to be detectable via
@@ -803,11 +821,16 @@ export class Language extends Thing {
   }
 
   #formatListHelper(array, processFn) {
+    // Empty lists, null, and undefined are blank content.
+    if (empty(array) || array === null || array === undefined) {
+      return html.blank();
+    }
+
     // Blank items aren't for display.
     array = array.filter(item => !html.isBlank(item));
 
-    // Empty lists, null, and undefined are blank content.
-    if (empty(array) || array === null || array === undefined) {
+    // Empty lists are blank content.  (2, The Sequel)
+    if (empty(array)) {
       return html.blank();
     }
 
diff --git a/src/urls-default.yaml b/src/urls-default.yaml
index dfa5b0e9..5c6f7245 100644
--- a/src/urls-default.yaml
+++ b/src/urls-default.yaml
@@ -11,7 +11,7 @@ yamlAliases:
   # part of a build. This is so that multiple builds of a wiki can coexist
   # served from the same server / file system root: older builds' HTML files
   # refer to earlier values of STATIC_VERSION, avoiding name collisions.
-  - &staticVersion 5p10
+  - &staticVersion 5p11
 
 data:
   prefix: 'data/'