diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-11-23 18:50:59 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-11-24 13:45:21 -0400 |
commit | cf08893d48db6f8082a176f54d0d92cb82716b3a (patch) | |
tree | 399e3b8543c8993660f2af67a2fa324970774d8d /src/data | |
parent | 0ee5269cd196cd14f06aac6c586e7104159eac74 (diff) |
external-links: general support for page-contextual formatting
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/things/language.js | 16 |
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; |