Added comment

pull/46/head
MillenniumEarl 2020-11-02 18:47:24 +01:00
parent 3b6522a9bd
commit 1dd57954b0
1 changed files with 2 additions and 3 deletions

View File

@ -126,14 +126,13 @@ function extractInfoFromTitle(body) {
}); });
name = name.trim(); name = name.trim();
// The regex [[\]]+ remove the square brackets
// The version is the penultimate element. // The version is the penultimate element.
// If the matches are less than 2, than the title // If the matches are less than 2, than the title
// is malformes and only the author is fetched // is malformes and only the author is fetched
// (usually the author is always present) // (usually the author is always present)
let version = null; let version = null;
if (matches.length >= 2) { if (matches.length >= 2) {
// The regex [[\]]+ remove the square brackets
version = matches[matches.length - 2].replace(/[[\]]+/g, "").trim(); version = matches[matches.length - 2].replace(/[[\]]+/g, "").trim();
// If the version is in the format v1.0 remove the "v" // If the version is in the format v1.0 remove the "v"
@ -146,7 +145,7 @@ function extractInfoFromTitle(body) {
} }
else shared.logger.trace(`Malformed title: ${title}`); else shared.logger.trace(`Malformed title: ${title}`);
// Last element // Last element (the regex [[\]]+ remove the square brackets)
const author = matches[matches.length - 1].replace(/[[\]]+/g, "").trim(); const author = matches[matches.length - 1].replace(/[[\]]+/g, "").trim();
return { return {