Clean up {{file}} usage in data paths

This commit is contained in:
mtkennerly 2020-07-16 01:24:41 -04:00
parent 9d189021c9
commit 553fb8db75
7 changed files with 249 additions and 197 deletions

View file

@ -16,6 +16,7 @@ interface Cli {
unsupportedOs?: boolean,
unsupportedPath?: boolean,
irregularPath?: boolean,
irregularPathUntagged?: boolean,
tooBroad?: boolean,
tooBroadUntagged?: boolean,
recent?: number,
@ -35,6 +36,7 @@ async function main() {
"unsupportedOs",
"unsupportedPath",
"irregularPath",
"irregularPathUntagged",
"tooBroad",
"tooBroadUntagged",
]
@ -77,6 +79,7 @@ async function main() {
tooBroad: args.tooBroad ?? false,
tooBroadUntagged: args.tooBroadUntagged ?? false,
irregularPath: args.irregularPath ?? false,
irregularPathUntagged: args.irregularPathUntagged ?? false,
games: args._,
recent: args.recent,
},

View file

@ -52,6 +52,7 @@ export class ManifestFile extends YamlFile<Manifest> {
unsupportedOs: boolean,
unsupportedPath: boolean,
irregularPath: boolean,
irregularPathUntagged: boolean,
tooBroad: boolean,
tooBroadUntagged: boolean,
games: Array<string> | undefined,
@ -81,7 +82,10 @@ export class ManifestFile extends YamlFile<Manifest> {
if (filter.unsupportedPath && info.unsupportedPath) {
check = true;
}
if (filter.irregularPath && (wikiCache[title].irregularPath || Object.keys(this.data[title]?.files ?? []).some(x => x.includes("{{") || x.includes("</") || x.includes("<br>") || x.includes("<br/>")))) {
if (filter.irregularPath && wikiCache[title].irregularPath) {
check = true;
}
if (filter.irregularPathUntagged && !wikiCache[title].irregularPath && Object.keys(this.data[title]?.files ?? []).some(x => x.includes("{{") || x.includes("</") || x.includes("<br>") || x.includes("<br/>"))) {
check = true;
}
if (filter.games && filter.games.includes(title)) {
@ -90,7 +94,7 @@ export class ManifestFile extends YamlFile<Manifest> {
if (filter.tooBroad && info.tooBroad) {
check = true;
}
if (filter.tooBroadUntagged && Object.keys(this.data[title]?.files ?? []).some(x => pathIsTooBroad(x))) {
if (filter.tooBroadUntagged && !info.tooBroad && Object.keys(this.data[title]?.files ?? []).some(x => pathIsTooBroad(x))) {
check = true;
}
if (filter.recent && wikiCache[title].recentlyChanged) {

View file

@ -466,12 +466,18 @@ export async function getGame(pageTitle: string, cache: WikiGameCache): Promise<
game.steam = { id: steamId };
}
} else if (template.name === "Game data/saves" || template.name === "Game data/config") {
// console.log("\n\n\n\n\n\n--------------------------------------------------------------------------")
// console.log(template);
for (const cellKey of Object.getOwnPropertyNames(template.parameters)) {
if (cellKey === "0" || cellKey === "1") {
continue;
}
const cell = template.parameters[cellKey];
// console.log("======================================")
// console.log(cell)
const [rawPath, regular] = getRawPathFromCell(cell);
// console.log("-----------------");
// console.log(`${regular} : ${rawPath}`);
if (!regular) {
irregularPath += 1;