From c833d83d21f8f186f6b69940ea065bc8ffb0adb4 Mon Sep 17 00:00:00 2001 From: Sarat Addepalli Date: Tue, 7 Aug 2018 10:30:26 +0530 Subject: [PATCH] doc: support 'removed' field in doc YAML sections PR-URL: https://github.com/nodejs/node/pull/22100 Reviewed-By: Vse Mozhet Byt Reviewed-By: Joyee Cheung --- tools/doc/common.js | 4 ++++ tools/doc/html.js | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/doc/common.js b/tools/doc/common.js index 4dfadd353d9ec8..7d8aefb65d84fd 100644 --- a/tools/doc/common.js +++ b/tools/doc/common.js @@ -34,6 +34,10 @@ function extractAndParseYAML(text) { meta.deprecated = arrify(meta.deprecated); } + if (meta.removed) { + meta.removed = arrify(meta.removed); + } + meta.changes = meta.changes || []; return meta; diff --git a/tools/doc/html.js b/tools/doc/html.js index d65a4b323aef36..f1ac9e144e61e1 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -264,6 +264,7 @@ function parseYAML(text) { const added = { description: '' }; const deprecated = { description: '' }; + const removed = { description: '' }; if (meta.added) { added.version = meta.added.join(', '); @@ -276,9 +277,15 @@ function parseYAML(text) { `Deprecated since: ${deprecated.version}`; } + if (meta.removed) { + removed.version = meta.removed.join(', '); + removed.description = `Removed in: ${removed.version}`; + } + if (meta.changes.length > 0) { if (added.description) meta.changes.push(added); if (deprecated.description) meta.changes.push(deprecated); + if (removed.description) meta.changes.push(removed); meta.changes.sort((a, b) => versionSort(a.version, b.version)); @@ -299,7 +306,8 @@ function parseYAML(text) { result += '\n\n'; } else { - result += `${added.description}${deprecated.description}\n`; + result += `${added.description}${deprecated.description}` + + `${removed.description}\n`; } if (meta.napiVersion) {