Skip to content

Commit

Permalink
enhance(kumascript): make smartLink() parameter content optional
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Oct 18, 2023
1 parent eae251e commit b004a82
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kumascript/src/api/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const web = {
this: KumaThis,
href: string,
title: string | null,
content: string,
content: string | null = null,
subpath: string | null = null,
basepath: string | null = null,
ignoreFlawMacro: string | null = null
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 b004a82

Please sign in to comment.