Skip to content

Commit 5105060

Browse files
aduh95danielleadams
authored andcommitted
tools: fix stability index generation
PR-URL: #45346 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
1 parent 89b3336 commit 5105060

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tools/doc/json.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ export function jsonAPI({ filename }) {
104104
nodes.slice(0, i).every((node) => node.type === 'list')
105105
) {
106106
const text = textJoin(node.children[0].children, file);
107-
const stability = text.match(stabilityExpr);
107+
const stability = stabilityExpr.exec(text);
108108
if (stability) {
109109
current.stability = parseInt(stability[1], 10);
110-
current.stabilityText = stability[2].trim();
110+
current.stabilityText = stability[2].replaceAll('\n', ' ').trim();
111111
delete nodes[i];
112112
}
113113
}

tools/doc/stability.mjs

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,17 @@ function collectStability(data) {
3030
if (mod.displayName && mod.stability >= 0) {
3131
const link = mod.source.replace('doc/api/', '').replace('.md', '.html');
3232

33+
let { stabilityText } = mod;
34+
if (stabilityText.includes('. ')) {
35+
stabilityText = stabilityText.slice(0, stabilityText.indexOf('.'));
36+
}
37+
3338
stability.push({
3439
api: mod.name,
3540
displayName: mod.textRaw,
3641
link: link,
3742
stability: mod.stability,
38-
stabilityText: `(${mod.stability}) ${mod.stabilityText}`,
43+
stabilityText: `(${mod.stability}) ${stabilityText}`,
3944
});
4045
}
4146
}

0 commit comments

Comments
 (0)