Improved changelog detection

pull/47/head
MillenniumEarl 2020-11-19 20:45:05 +01:00
parent 7ce02dce06
commit 48df148289
2 changed files with 6 additions and 1 deletions

View File

@ -6,7 +6,7 @@ module.exports = Object.freeze({
GT_TAGS: "a.tagItem",
GT_TITLE: "h1.p-title-value",
GT_TITLE_PREFIXES: "h1.p-title-value > a.labelLink > span[dir=\"auto\"]",
GT_LAST_CHANGELOG: "div.bbCodeBlock-content > div:first-of-type",
GT_LAST_CHANGELOG: "b:contains('Changelog') + br + div > div",
GT_JSONLD: "script[type=\"application/ld+json\"]",
WT_FILTER_POPUP_BUTTON: "a.filterBar-menuTrigger",
WT_NEXT_PAGE: "a.pageNav-jump--next",

View File

@ -204,6 +204,11 @@ function extractChangelog(mainPost) {
changelog = changelog.replace(/\n+/g, "\n");
changelog = changelog.trim();
// Delete the version at the start of the changelog
const firstNewLine = changelog.indexOf("\n");
const supposedVersion = changelog.substring(0, firstNewLine);
if (supposedVersion[0] === "v") changelog = changelog.substring(firstNewLine).trim();
// Return changelog
return changelog ? changelog : null;
}