mirror of
https://github.com/awesome-selfhosted/awesome-selfhosted.git
synced 2024-11-30 04:03:57 +00:00
Fix test.js
Fix regex filters on test.js
This commit is contained in:
parent
0d0c32ec91
commit
6283012dd8
1 changed files with 10 additions and 10 deletions
20
test.js
20
test.js
|
@ -8,7 +8,7 @@ let issuelog = ' "message": "#### Syntax Issues\\n\\n Name | Entry\\n----|-----
|
||||||
const file = fs.readFileSync(process.argv[2], 'utf8'); // Reads argv into var file
|
const file = fs.readFileSync(process.argv[2], 'utf8'); // Reads argv into var file
|
||||||
|
|
||||||
function entryFilter(md) { // Function to find lines with entries
|
function entryFilter(md) { // Function to find lines with entries
|
||||||
const linepatt = /^ {0,4}\* \[.*`/;
|
const linepatt = /^\s{0,2}-\s\[.*`/;
|
||||||
return linepatt.test(md);
|
return linepatt.test(md);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,14 +17,14 @@ function split(text) { // Function to split lines into array
|
||||||
}
|
}
|
||||||
|
|
||||||
function findPattern(text) { // Test entries against 8 patterns. If matches pattern returns true
|
function findPattern(text) { // Test entries against 8 patterns. If matches pattern returns true
|
||||||
const nodnospatt = /^ {0,4}\* \[.*?\]\(.*?\) - .{0,249}?\. `.*?` `.*?`/; // Regex for entries with no demo and no source code
|
const nodnospatt = /^-\s{0,2}\s\[.*?\]\(.*?\) - .{0,249}?\. `.*?` `.*?`/; // Regex for entries with no demo and no source code
|
||||||
const slpatt = /^ {0,4}\* \[.*?\]\(.*?\) - .{0,249}?\. \(\[Demo\b\]\(.*?\), \[Source Code\b\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with demo and source code
|
const slpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. \(\[Demo\b\]\(.*?\), \[Source Code\b\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with demo and source code
|
||||||
const nodpatt = / {0,4}\* \[.*?\]\(.*?\) - .{0,249}?\. \(\[Source Code\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with no demo
|
const nodpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. \(\[Source Code\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with no demo
|
||||||
const nospatt = / {0,4}\* \[.*?\]\(.*?\) - .{0,249}?\. \(\[Demo\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with no source code
|
const nospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. \(\[Demo\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with no source code
|
||||||
const pnodnospatt = / {0,4}\* \[.*?\]\(.*?\) `⚠` - .{0,249}?\. `.*?` `.*?`/; // Regex for entries with proprietary with no demo and no source code
|
const pnodnospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. `.*?` `.*?`/; // Regex for entries with proprietary with no demo and no source code
|
||||||
const pslpatt = / {0,4}\* \[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Demo\b\]\(.*?\), \[Source Code\b\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with demo and source code
|
const pslpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Demo\b\]\(.*?\), \[Source Code\b\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with demo and source code
|
||||||
const pnodpatt = / {0,4}\* \[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Source Code\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with no demo
|
const pnodpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Source Code\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with no demo
|
||||||
const pnospatt = / {0,4}\* \[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Demo\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with no source code
|
const pnospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Demo\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with no source code
|
||||||
if (nodnospatt.test(text) === true) {
|
if (nodnospatt.test(text) === true) {
|
||||||
return true;
|
return true;
|
||||||
} else if (slpatt.test(text) === true) {
|
} else if (slpatt.test(text) === true) {
|
||||||
|
@ -46,7 +46,7 @@ function findPattern(text) { // Test entries against 8 patterns. If matches pat
|
||||||
}
|
}
|
||||||
|
|
||||||
function entryErrorCheck(md) {
|
function entryErrorCheck(md) {
|
||||||
const namepatt = /\* \[(.*?)\]/; // regex pattern to find name of entryArray
|
const namepatt = /^\s{0,2}-\s\[(.*?)\]/; // regex pattern to find name of entryArray
|
||||||
const entries = split(md); // Inserts each line into the entries array
|
const entries = split(md); // Inserts each line into the entries array
|
||||||
let totalFail = 0;
|
let totalFail = 0;
|
||||||
let totalPass = 0;
|
let totalPass = 0;
|
||||||
|
|
Loading…
Reference in a new issue