diff --git a/tools/doc/common.js b/tools/doc/common.js index 7d8aefb65d84fd..86daae6cfc6d56 100644 --- a/tools/doc/common.js +++ b/tools/doc/common.js @@ -43,4 +43,4 @@ function extractAndParseYAML(text) { return meta; } -module.exports = { isYAMLBlock, extractAndParseYAML }; +module.exports = { arrify, isYAMLBlock, extractAndParseYAML }; diff --git a/tools/doc/html.js b/tools/doc/html.js index 5babe1c97e679a..c0a94b6534b171 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -308,7 +308,9 @@ function parseYAML(text) { .use(htmlStringify) .processSync(change.description).toString(); - result += `${change.version}\n` + + const version = common.arrify(change.version).join(', '); + + result += `${version}\n` + `${description}\n`; }); @@ -326,10 +328,16 @@ function parseYAML(text) { return result; } +function minVersion(a) { + return common.arrify(a).reduce((min, e) => { + return !min || versionSort(min, e) < 0 ? e : min; + }); +} + const numberRe = /^\d*/; function versionSort(a, b) { - a = a.trim(); - b = b.trim(); + a = minVersion(a).trim(); + b = minVersion(b).trim(); let i = 0; // Common prefix length. while (i < a.length && i < b.length && a[i] === b[i]) i++; a = a.substr(i);