Skip to content

Commit

Permalink
fix: update detection of changelog links (take 2) (#575)
Browse files Browse the repository at this point in the history
Underscores in the links to the changelogs are escaped for markdown
links but not escaped for HTML links.
  • Loading branch information
richardlau committed Oct 26, 2021
1 parent 44c6fc8 commit e66ba17
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/prepare_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,18 @@ class ReleasePreparation {
const arr = data.split('\n');

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

for (let idx = 0; idx < arr.length; idx++) {
if (isLTSTransition) {
if (arr[idx].includes(hrefLink)) {
if (arr[idx].includes(escapedHrefLink)) {
arr[idx] = arr[idx].replace('**Current**', '**Long Term Support**');
} else if (arr[idx].includes(hrefLink)) {
const eolDate = getEOLDate(date);
const eol = eolDate.toISOString().split('-').slice(0, 2).join('-');
arr[idx] = arr[idx].replace('**Current**', '**Long Term Support**');
arr[idx] = arr[idx].replace('"Current"', `"LTS Until ${eol}"`);
arr[idx] = arr[idx].replace('<sup>Current</sup>', '<sup>LTS</sup>');
} else if (arr[idx].includes('**Long Term Support**')) {
Expand Down

0 comments on commit e66ba17

Please sign in to comment.