Skip to content

Commit

Permalink
fix(macros/jsxref): fix dot handling (#11869)
Browse files Browse the repository at this point in the history
fix(jsxref): fix dot handling

Previously we replaces all single dots with a slash.
This resulted in:
{{jsxref("Operators/new%2Etarget", "new.target")}}

An alternative is to change the logic to:

If there is an slash in the 1st parameter don't replace the dots.
This works for all en-US and the issue I found in translated content
where alread broken.
  • Loading branch information
fiji-flo authored Sep 30, 2024
1 parent 0f5a50b commit de1a76a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kumascript/macros/jsxref.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const anchor = $2 || '';
const wrap = !$3;
let slug = apiName.replace('()', '').replace('.prototype.', '.');
if (apiName.includes(".") && !apiName.includes("..")) {
// E.g. "Array.filter", but not "try...catch".
if (apiName.includes(".") && !apiName.includes("/")) {
// E.g. "Array.filter", but not "Statements/try...catch".
slug = slug.replace('.', '/');
}
Expand Down

0 comments on commit de1a76a

Please sign in to comment.