« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/language.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/data/things/language.js b/src/data/things/language.js
index 185488e2..f83b4218 100644
--- a/src/data/things/language.js
+++ b/src/data/things/language.js
@@ -3,6 +3,7 @@ import {Tag} from '#html';
 
 import {
   getExternalLinkStringsFromDescriptors,
+  isExternalLinkContext,
   isExternalLinkSpec,
   isExternalLinkStyle,
 } from '#external-links';
@@ -312,17 +313,22 @@ export class Language extends Thing {
       : duration;
   }
 
-  formatExternalLink(url, {style = 'normal'} = {}) {
+  formatExternalLink(url, {
+    style = 'normal',
+    context = 'generic',
+  } = {}) {
     if (!this.externalLinkSpec) {
       throw new TypeError(`externalLinkSpec unavailable`);
     }
 
-    if (style !== 'all') {
-      isExternalLinkStyle(style);
-    }
+    if (style !== 'all') isExternalLinkStyle(style);
+    isExternalLinkContext(context);
 
     const results =
-      getExternalLinkStringsFromDescriptors(url, this.externalLinkSpec, this);
+      getExternalLinkStringsFromDescriptors(url, this.externalLinkSpec, {
+        language: this,
+        context,
+      });
 
     if (style === 'all') {
       return results;