Skip to content

Commit

Permalink
tools: fix stability index generation
Browse files Browse the repository at this point in the history
PR-URL: #45346
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
  • Loading branch information
aduh95 authored and RafaelGSS committed Nov 10, 2022
1 parent 326d19a commit e275859
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tools/doc/json.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ export function jsonAPI({ filename }) {
nodes.slice(0, i).every((node) => node.type === 'list')
) {
const text = textJoin(node.children[0].children, file);
const stability = text.match(stabilityExpr);
const stability = stabilityExpr.exec(text);
if (stability) {
current.stability = parseInt(stability[1], 10);
current.stabilityText = stability[2].trim();
current.stabilityText = stability[2].replaceAll('\n', ' ').trim();
delete nodes[i];
}
}
Expand Down
7 changes: 6 additions & 1 deletion tools/doc/stability.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ function collectStability(data) {
if (mod.displayName && mod.stability >= 0) {
const link = mod.source.replace('doc/api/', '').replace('.md', '.html');

let { stabilityText } = mod;
if (stabilityText.includes('. ')) {
stabilityText = stabilityText.slice(0, stabilityText.indexOf('.'));
}

stability.push({
api: mod.name,
displayName: mod.textRaw,
link: link,
stability: mod.stability,
stabilityText: `(${mod.stability}) ${mod.stabilityText}`,
stabilityText: `(${mod.stability}) ${stabilityText}`,
});
}
}
Expand Down

0 comments on commit e275859

Please sign in to comment.