doc: support 'removed' field in doc YAML sections
PR-URL: https://github.com/nodejs/node/pull/22100 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
parent
e10290cc67
commit
c917540f22
@ -34,6 +34,10 @@ function extractAndParseYAML(text) {
|
|||||||
meta.deprecated = arrify(meta.deprecated);
|
meta.deprecated = arrify(meta.deprecated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (meta.removed) {
|
||||||
|
meta.removed = arrify(meta.removed);
|
||||||
|
}
|
||||||
|
|
||||||
meta.changes = meta.changes || [];
|
meta.changes = meta.changes || [];
|
||||||
|
|
||||||
return meta;
|
return meta;
|
||||||
|
@ -264,6 +264,7 @@ function parseYAML(text) {
|
|||||||
|
|
||||||
const added = { description: '' };
|
const added = { description: '' };
|
||||||
const deprecated = { description: '' };
|
const deprecated = { description: '' };
|
||||||
|
const removed = { description: '' };
|
||||||
|
|
||||||
if (meta.added) {
|
if (meta.added) {
|
||||||
added.version = meta.added.join(', ');
|
added.version = meta.added.join(', ');
|
||||||
@ -276,9 +277,15 @@ function parseYAML(text) {
|
|||||||
`<span>Deprecated since: ${deprecated.version}</span>`;
|
`<span>Deprecated since: ${deprecated.version}</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (meta.removed) {
|
||||||
|
removed.version = meta.removed.join(', ');
|
||||||
|
removed.description = `<span>Removed in: ${removed.version}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
if (meta.changes.length > 0) {
|
if (meta.changes.length > 0) {
|
||||||
if (added.description) meta.changes.push(added);
|
if (added.description) meta.changes.push(added);
|
||||||
if (deprecated.description) meta.changes.push(deprecated);
|
if (deprecated.description) meta.changes.push(deprecated);
|
||||||
|
if (removed.description) meta.changes.push(removed);
|
||||||
|
|
||||||
meta.changes.sort((a, b) => versionSort(a.version, b.version));
|
meta.changes.sort((a, b) => versionSort(a.version, b.version));
|
||||||
|
|
||||||
@ -299,7 +306,8 @@ function parseYAML(text) {
|
|||||||
|
|
||||||
result += '</table>\n</details>\n';
|
result += '</table>\n</details>\n';
|
||||||
} else {
|
} else {
|
||||||
result += `${added.description}${deprecated.description}\n`;
|
result += `${added.description}${deprecated.description}` +
|
||||||
|
`${removed.description}\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meta.napiVersion) {
|
if (meta.napiVersion) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user