From 3ebd396e41b914bd6fc73384fc146ec4dcf3a910 Mon Sep 17 00:00:00 2001 From: Claas Augner <495429+caugner@users.noreply.github.com> Date: Wed, 29 Nov 2023 12:26:36 +0100 Subject: [PATCH] enhance(kumascript): make `smartLink()`'s content parameter optional (#9847) * chore(kumascript): type smartLink() params Derived by recording the types of all parameters during a full build of the English locale. * enhance(kumascript): make smartLink() parameter content optional --- kumascript/src/api/web.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/kumascript/src/api/web.ts b/kumascript/src/api/web.ts index ff4dd43c396d..5697b10a7425 100644 --- a/kumascript/src/api/web.ts +++ b/kumascript/src/api/web.ts @@ -51,12 +51,12 @@ const web = { // then hyperlink to corresponding en-US document is returned. smartLink( this: KumaThis, - href, - title, - content, - subpath, - basepath, - ignoreFlawMacro = null + href: string, + title: string | null, + content: string | null = null, + subpath: string | null = null, + basepath: string | null = null, + ignoreFlawMacro: string | null = null ) { let flaw; let flawAttribute = ""; @@ -128,6 +128,7 @@ const web = { } } const titleAttribute = title ? ` title="${title}"` : ""; + content ??= page.short_title ?? page.title; return `${content}`; @@ -150,6 +151,7 @@ const web = { flaw.macroSource )}"`; } + content ??= enUSPage.short_title ?? enUSPage.title; return ( '${content}`; },