From 222fe21185c80e9d539c0c3646c22fc4a410c03d Mon Sep 17 00:00:00 2001 From: MillenniumEarl Date: Sat, 7 Nov 2020 18:05:48 +0100 Subject: [PATCH] Remove trailing v from version and \n from changelog --- app/scripts/scraper.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/scripts/scraper.js b/app/scripts/scraper.js index 7f20b30..bf3dd0f 100644 --- a/app/scripts/scraper.js +++ b/app/scripts/scraper.js @@ -135,13 +135,8 @@ function extractInfoFromTitle(body) { // The regex [[\]]+ remove the square brackets version = matches[matches.length - 2].replace(/[[\]]+/g, "").trim(); - // If the version is in the format v1.0 remove the "v" - if (version[0].toUpperCase() === "V" && !isNaN(version[1])) { - const indexOfCharToRemove = 0; // The first letter - const tmp = version.split(""); // Convert to an array - tmp.splice(indexOfCharToRemove, 1); // Remove the first element - version = tmp.join(""); // Reconstruct the version - } + // Remove the trailing "v" + if (version[0] === "v") version.replace("v", ""); } else shared.logger.trace(`Malformed title: ${title}`); @@ -202,6 +197,7 @@ function extractChangelog(mainPost) { // Clean changelog changelog = changelog.replace("Spoiler", ""); changelog = changelog.replace(/\n+/g, "\n"); + changelog = changelog.trim(); // Return changelog return changelog ? changelog : null;