Ignore templates without paths

This commit is contained in:
mtkennerly 2023-11-28 20:56:12 +08:00
parent 7f24937f0b
commit dbaac7d642
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
2 changed files with 14 additions and 23 deletions

View file

@ -6864,9 +6864,6 @@ Alien Rampage:
Alien Removal Division:
pageId: 191396
steam: 1768550
templates:
- "{{Game data/config|Windows|}}"
- "{{Game data/saves|Windows|}}"
Alien Revival - Episode 1 - Duty Calls:
pageId: 103161
steam: 770830
@ -11674,9 +11671,6 @@ Asphyxia:
steam: 1720090
Assassin 2015:
pageId: 191398
templates:
- "{{Game data/config|Windows|}}"
- "{{Game data/saves|Windows|}}"
"Assassin's Creed":
gog: 1207659023
pageId: 84
@ -26078,7 +26072,6 @@ Cardfight!! Vanguard Dear Days:
pageId: 180606
steam: 1881420
templates:
- "{{Game data/config|Windows|}}"
- "{{Game data/saves|Windows|{{p|userprofile}}\\Saved Games\\VG2\\SAVELOAD}}"
Cardiganical:
pageId: 108304
@ -31344,11 +31337,7 @@ Cold War:
steam: 260650
templates:
- "{{Game data/config|Windows|{{p|userprofile\\Documents}}\\Cold War\\Config.txt}}"
- "{{Game data/config|OS X|}}"
- "{{Game data/config|Linux|}}"
- "{{Game data/saves|Windows|{{p|userprofile\\Documents}}\\Cold War\\Saves\\}}"
- "{{Game data/saves|OS X|}}"
- "{{Game data/saves|Linux|}}"
Cold War Game:
pageId: 145162
steam: 1047210
@ -64369,7 +64358,6 @@ GRID Autosport:
- 295100
templates:
- "{{Game data/config|Windows|{{p|userprofile\\Documents}}\\My Games\\GRID Autosport\\}}"
- "{{Game data/config|OS X|}}"
- "{{Game data/config|Linux|{{p|xdgdatahome}}/feral-interactive/GRID Autosport/preferences|{{p|xdgdatahome}}/feral-interactive/GRID Autosport/VFS/User/AppData/Roaming/My Games/GRID Autosport/hardwaresettings/}}"
- "{{Game data/saves|Steam|{{p|steam}}/userdata/{{p|uid}}/255220/remote/}}"
GRID Legends:
@ -68543,7 +68531,6 @@ Gordon Streaman:
pageId: 86768
templates:
- "{{Game data/config|Windows|{{p|game}}\\settings}}"
- "{{Game data/saves|Windows|}}"
Gorescript:
pageId: 61554
steam: 618690
@ -179546,9 +179533,6 @@ Unusual Findings:
steam: 1605320
Unvanquished:
pageId: 191397
templates:
- "{{Game data/config|Windows|}}"
- "{{Game data/saves|Windows|}}"
Unveil:
pageId: 43520
steam: 375210

View file

@ -341,7 +341,7 @@ impl WikiCacheEntry {
let wikitext = wikitext_parser::parse_wikitext(raw_wikitext, article, |_| ());
for template in wikitext.list_double_brace_expressions() {
if let wikitext_parser::TextPiece::DoubleBraceExpression { tag, attributes } = &template {
if let TextPiece::DoubleBraceExpression { tag, attributes } = &template {
match tag.to_string().to_lowercase().trim() {
"infobox game" => {
for attribute in attributes {
@ -385,13 +385,20 @@ impl WikiCacheEntry {
"game data" => {
for attribute in attributes {
for template in &attribute.value.pieces {
if let wikitext_parser::TextPiece::DoubleBraceExpression { tag, .. } = &template {
let is_save = tag.to_string() == "Game data/saves";
let is_config = tag.to_string() == "Game data/config";
if let TextPiece::DoubleBraceExpression { tag, attributes } = &template {
let is_save = tag.to_string().to_lowercase() == "game data/saves";
let is_config = tag.to_string().to_lowercase() == "game data/config";
if is_save || is_config {
out.templates.push(template.to_string());
if !is_save && !is_config {
continue;
}
// Ignore templates with an empty path parameter.
if attributes.len() > 1 && attributes[1].value.to_string().is_empty() {
continue;
}
out.templates.push(template.to_string());
}
}
}
@ -427,7 +434,7 @@ impl WikiCacheEntry {
let preprocessed = Self::preprocess_template(raw);
let parsed = wikitext_parser::parse_wikitext(&preprocessed, article.clone(), |_| ());
for template in parsed.list_double_brace_expressions() {
if let wikitext_parser::TextPiece::DoubleBraceExpression { tag, attributes } = &template {
if let TextPiece::DoubleBraceExpression { tag, attributes } = &template {
let is_save = tag.to_string() == "Game data/saves";
let is_config = tag.to_string() == "Game data/config";