Skip to content

Commit

Permalink
enhance(kumascript): make smartLink()'s content parameter optional (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
caugner authored Nov 29, 2023
1 parent bb60acd commit 3ebd396
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions kumascript/src/api/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -128,6 +128,7 @@ const web = {
}
}
const titleAttribute = title ? ` title="${title}"` : "";
content ??= page.short_title ?? page.title;
return `<a href="${
page.url + hrefhash
}"${titleAttribute}${flawAttribute}>${content}</a>`;
Expand All @@ -150,6 +151,7 @@ const web = {
flaw.macroSource
)}"`;
}
content ??= enUSPage.short_title ?? enUSPage.title;
return (
'<a class="only-in-en-us" ' +
'title="Currently only available in English (US)" ' +
Expand All @@ -171,6 +173,7 @@ const web = {
this.web.getJSONData("L10n-Common"),
"summary"
);
content ??= href;
return `<a class="page-not-created" title="${titleWhenMissing}"${flawAttribute}>${content}</a>`;
},

Expand Down

0 comments on commit 3ebd396

Please sign in to comment.