Skip to content

Commit 0482bb8

Browse files
committed
fix: update detection of changelog links (take 2)
Underscores in the links to the changelogs are escaped for markdown links but not escaped for HTML links.
1 parent 44c6fc8 commit 0482bb8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/prepare_release.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,18 @@ class ReleasePreparation {
332332
const arr = data.split('\n');
333333

334334
const major = versionComponents.major;
335-
const hrefLink = `doc/changelogs/CHANGELOG\\_V${major}.md`;
335+
const hrefLink = `doc/changelogs/CHANGELOG_V${major}.md`;
336+
const escapedHrefLink = hrefLink.replace(/_/g, '\\_');
336337
const newRefLink = `<a href="${hrefLink}#${newVersion}">${newVersion}</a>`;
337338
const lastRefLink = `<a href="${hrefLink}#${lastRef}">${lastRef}</a>`;
338339

339340
for (let idx = 0; idx < arr.length; idx++) {
340341
if (isLTSTransition) {
341-
if (arr[idx].includes(hrefLink)) {
342+
if (arr[idx].includes(escapedHrefLink)) {
343+
arr[idx] = arr[idx].replace('**Current**', '**Long Term Support**');
344+
} else if (arr[idx].includes(hrefLink)) {
342345
const eolDate = getEOLDate(date);
343346
const eol = eolDate.toISOString().split('-').slice(0, 2).join('-');
344-
arr[idx] = arr[idx].replace('**Current**', '**Long Term Support**');
345347
arr[idx] = arr[idx].replace('"Current"', `"LTS Until ${eol}"`);
346348
arr[idx] = arr[idx].replace('<sup>Current</sup>', '<sup>LTS</sup>');
347349
} else if (arr[idx].includes('**Long Term Support**')) {

0 commit comments

Comments
 (0)