From f4370d335fed59cd040ecbc23afbf538712b915f Mon Sep 17 00:00:00 2001 From: Nathan Rew Date: Sun, 16 Aug 2020 09:16:50 +0900 Subject: prevent error when `.` is in the name --- tests/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test.js') diff --git a/tests/test.js b/tests/test.js index 9d2ef63c..a62b01a7 100644 --- a/tests/test.js +++ b/tests/test.js @@ -83,7 +83,7 @@ function testDescription(text) { function testSrcDemCli(text) { let testC = text.search(/\(\[|\)\,|\)\)/); let testD = /(?<=\w. )(\(\[(Demo|Source Code|Clients)\]\([^)\]]*\)(, \[(Source Code|Clients)\]\([^)\]]*\))?(, \[(Source Code|Clients)\]\([^)\]]*\))*\))(?= \`?)/; - const testD1 = /(^- \W[a-zA-Z0-9-_ ]*\W{0,2}http[^\[]*)(?<= )/; + const testD1 = /(^- \W[a-zA-Z0-9-_ .]*\W{0,2}http[^\[]*)(?<= )/; const testD2 = /(\`.*\` \`.*\`$)/; if ((testC > -1) && (!testD.test(text))) { let d1 = testD1.exec(text)[1]; -- cgit v1.2.3 From 98e01c976929ed72377975f2a3207a554cfd9433 Mon Sep 17 00:00:00 2001 From: Nathan Rew Date: Sun, 16 Aug 2020 10:03:04 +0900 Subject: Update regex checks for Source Code, Demo, Clients --- tests/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test.js') diff --git a/tests/test.js b/tests/test.js index a62b01a7..5e44c29a 100644 --- a/tests/test.js +++ b/tests/test.js @@ -81,7 +81,7 @@ function testDescription(text) { //If present, tests '([Demo](http://url.to/demo), [Source Code](http://url.of/source/code), [Clients](https://url.to/list/of/related/clients-or-apps))' function testSrcDemCli(text) { - let testC = text.search(/\(\[|\)\,|\)\)/); + let testC = text.search(/\.\ \(|\.\ \[|\ \(\[[sSdDcC]/); // /\(\[|\)\,|\)\)/); let testD = /(?<=\w. )(\(\[(Demo|Source Code|Clients)\]\([^)\]]*\)(, \[(Source Code|Clients)\]\([^)\]]*\))?(, \[(Source Code|Clients)\]\([^)\]]*\))*\))(?= \`?)/; const testD1 = /(^- \W[a-zA-Z0-9-_ .]*\W{0,2}http[^\[]*)(?<= )/; const testD2 = /(\`.*\` \`.*\`$)/; -- cgit v1.2.3 From b0cb23bd921d472be3d1091eab8abd1b88fb4ace Mon Sep 17 00:00:00 2001 From: Nathan Rew Date: Sun, 16 Aug 2020 11:12:27 +0900 Subject: Fix regex for mainlink. --- tests/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test.js') diff --git a/tests/test.js b/tests/test.js index 5e44c29a..36ee3e4e 100644 --- a/tests/test.js +++ b/tests/test.js @@ -57,7 +57,7 @@ function parseLicense(md) { //Test '- [Name](http://homepage/)' function testMainLink(text) { - let testA = /(^ {0,2}- \[.*?\]\(.*\))(?=.?-? ?\w)/; + let testA = /(^ {0,2}- \[.*?\]\([^)]*\.[^)]*?\))(?=\ ?\-?\ ?\w)/ // /(^ {0,2}- \[.*?\]\(.*\))(?=.?-? ?\w)/; const testA1 = /(- \W?\w*\W{0,2}.*?\)?)( .*$)/; if (!testA.test(text)) { let a1 = testA1.exec(text)[2]; -- cgit v1.2.3