Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e0cda56

Browse filesBrowse files
welfozlpinca
authored andcommitted
tools: fix incorrect version history order
This fixes an error in parseYAML(text), the version sorting coudn't be right as we compared an arrify string (ie. a = ["v18.11, v16.7.0"]) with an array of strings (ie. b = ["v18.07", "v16.7.0"]) in versionSort(a, b). minVersion(a) couldn't find the minimum version with an arrify string like a = ["v18.11, v16.7.0"]. That's why incorrect version history orders sometimes appeared. Furthermore, no need to sort the added version as it always comes first. So, it can be the last one to be pushed in the meta.changes array. Fixes: #45670 Co-authored-by: Luigi Pinca <luigipinca@gmail.com> PR-URL: #45728 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 7438ff1 commit e0cda56
Copy full SHA for e0cda56

File tree

Expand file treeCollapse file tree

2 files changed

+10
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-9
lines changed
Open diff view settings
Collapse file

‎test/doctool/test-doctool-html.mjs‎

Copy file name to clipboardExpand all lines: test/doctool/test-doctool-html.mjs
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ const testData = [
7979
'<div class="api_metadata">' +
8080
'<details class="changelog"><summary>History</summary>' +
8181
'<table><tbody><tr><th>Version</th><th>Changes</th></tr>' +
82+
'<tr><td>v4.2.0</td><td><p>The <code>error</code> parameter can now be' +
83+
'an arrow function.</p></td></tr>' +
8284
'<tr><td>v5.3.0, v4.2.0</td>' +
8385
'<td><p><span>Added in: v5.3.0, v4.2.0</span></p></td></tr>' +
84-
'<tr><td>v4.2.0</td><td><p>The <code>error</code> parameter can now be' +
85-
'an arrow function.</p></td></tr></tbody></table></details></div> ' +
86+
'</tbody></table></details></div> ' +
8687
'<p>Describe <code>Foobar II</code> in more detail here.' +
8788
'<a href="http://man7.org/linux/man-pages/man1/fg.1.html"><code>fg(1)' +
8889
'</code></a></p></section><section>' +
Collapse file

‎tools/doc/html.mjs‎

Copy file name to clipboardExpand all lines: tools/doc/html.mjs
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,27 +325,27 @@ function parseYAML(text) {
325325
const removed = { description: '' };
326326

327327
if (meta.added) {
328-
added.version = meta.added.join(', ');
329-
added.description = `<span>Added in: ${added.version}</span>`;
328+
added.version = meta.added;
329+
added.description = `<span>Added in: ${added.version.join(', ')}</span>`;
330330
}
331331

332332
if (meta.deprecated) {
333-
deprecated.version = meta.deprecated.join(', ');
333+
deprecated.version = meta.deprecated;
334334
deprecated.description =
335-
`<span>Deprecated since: ${deprecated.version}</span>`;
335+
`<span>Deprecated since: ${deprecated.version.join(', ')}</span>`;
336336
}
337337

338338
if (meta.removed) {
339-
removed.version = meta.removed.join(', ');
340-
removed.description = `<span>Removed in: ${removed.version}</span>`;
339+
removed.version = meta.removed;
340+
removed.description = `<span>Removed in: ${removed.version.join(', ')}</span>`;
341341
}
342342

343343
if (meta.changes.length > 0) {
344-
if (added.description) meta.changes.push(added);
345344
if (deprecated.description) meta.changes.push(deprecated);
346345
if (removed.description) meta.changes.push(removed);
347346

348347
meta.changes.sort((a, b) => versionSort(a.version, b.version));
348+
if (added.description) meta.changes.push(added);
349349

350350
result += '<details class="changelog"><summary>History</summary>\n' +
351351
'<table>\n<tr><th>Version</th><th>Changes</th></tr>\n';

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.