« get me outta code hell

language: drop externalLinkSpec prop, just import directly - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-10-20 13:09:58 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-20 13:09:58 -0300
commitc3b4b0bebca07a69f6c47d680f0c18d859cb599c (patch)
tree0dcdc81d6d421b1decb1ee66d018de70e3c566f8 /src/data/things
parent2374124f0b9f758021648e8bd3d99c205b2e3aea (diff)
language: drop externalLinkSpec prop, just import directly preview
this lets us totally drop "internal" but exported function
initializeLanguageObject - we'll still need to provide the
external link spec in essentially the exact same way in the
future, when external link spec is dynamic, but presently
there's no need for this function or providing at all.
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/language.js17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/data/things/language.js b/src/data/things/language.js
index 997cf31e..631df94d 100644
--- a/src/data/things/language.js
+++ b/src/data/things/language.js
@@ -10,10 +10,10 @@ import Thing from '#thing';
 import {languageOptionRegex} from '#wiki-data';
 
 import {
+  externalLinkSpec,
   getExternalLinkStringOfStyleFromDescriptors,
   getExternalLinkStringsFromDescriptors,
   isExternalLinkContext,
-  isExternalLinkSpec,
   isExternalLinkStyle,
 } from '#external-links';
 
@@ -82,13 +82,6 @@ export class Language extends Thing {
       update: {validate: (t) => typeof t === 'object'},
     },
 
-    // List of descriptors for providing to external link utilities when using
-    // language.formatExternalLink - refer to #external-links for info.
-    externalLinkSpec: {
-      flags: {update: true, expose: true},
-      update: {validate: isExternalLinkSpec},
-    },
-
     // Expose only
 
     isLanguage: [
@@ -648,10 +641,6 @@ export class Language extends Thing {
     style = 'platform',
     context = 'generic',
   } = {}) {
-    if (!this.externalLinkSpec) {
-      throw new TypeError(`externalLinkSpec unavailable`);
-    }
-
     // Null or undefined url is blank content.
     if (url === null || url === undefined) {
       return html.blank();
@@ -660,7 +649,7 @@ export class Language extends Thing {
     isExternalLinkContext(context);
 
     if (style === 'all') {
-      return getExternalLinkStringsFromDescriptors(url, this.externalLinkSpec, {
+      return getExternalLinkStringsFromDescriptors(url, externalLinkSpec, {
         language: this,
         context,
       });
@@ -669,7 +658,7 @@ export class Language extends Thing {
     isExternalLinkStyle(style);
 
     const result =
-      getExternalLinkStringOfStyleFromDescriptors(url, style, this.externalLinkSpec, {
+      getExternalLinkStringOfStyleFromDescriptors(url, style, externalLinkSpec, {
         language: this,
         context,
       });