doc: fix stability 1.x links excluding the decimal digit#58783
Conversation
|
Review requested:
|
0c3c90c to
391b587
Compare
| node.children.unshift({ | ||
| type: 'html', | ||
| value: `<div class="api_stability api_stability_${number}">` + | ||
| value: `<div class="api_stability api_stability_${parseInt(number)}">` + |
There was a problem hiding this comment.
parseInt will only grab the numeric pieces of "number" right?
There was a problem hiding this comment.
Yes, in the regex that the part for number is /\d(?:\.\d)? meaning that the number matched value can be a single digit optionally followed by a dot followed by another digit, parseInt run on such numbers/strings always returns the integer part of the number:

And that's the part we need based on the css classes we have:
Lines 324 to 338 in d7becc5
There was a problem hiding this comment.
I used the same trick in the web generator :-)
There was a problem hiding this comment.
I just wanted to confirm. I recall either parseInt or Number() parse the numeric parseable stuff until it finds something non-numeric.
There was a problem hiding this comment.
No, not until it finds something non-numeric. It parses the float since it's a valid number, and flattens it to an integer.
|
Note to web infra teams: this doesn't need to be ported to |
Thanks, I was about to ask someone at some point if this needed porting (as I haven't looked too much into the new tooling I must admit 😓) but you saved me the effort 🫶 |
|
Landed in d8de8f3 |
|
I wish I could have landed this haha; Ah how it sucks not being a collaborator anymore lol |
PR-URL: #58783 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #58783 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
PR-URL: #58783 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Pretty minor, this is just addressing a minimal UI quirk I noticed with the
Stability 1.xlinks where the decimal digits are not included in the hyperlinkPS: I've also moved the regex outside of the
preprocessElementsfunction, as there is no reason/benefit to have the regex rebuilt for every file (having it outside might save some precious nanoseconds when building the docs 😅).Before
After