User:Keller999/projects/gamepageupdate: Difference between revisions

Jump to navigation Jump to search
m
Small script update -- still some bugs/updates to work on with the image code
(New game page processing script, NEED YOUR INPUT!)
m (Small script update -- still some bugs/updates to work on with the image code)
Line 26: Line 26:
my (@problemSection, @configurationSection, @versionCompatSection, @testingSection, @videoSection, @categorySection);
my (@problemSection, @configurationSection, @versionCompatSection, @testingSection, @videoSection, @categorySection);
my @finalResult;
my @finalResult;
$imageSize = 300;


my ($savedImageLine, $savedSizeLine);
my ($savedImageLine, $savedSizeLine);
Line 133: Line 135:
}
}
}
}




Line 141: Line 145:
$foundInfobox = 0;
$foundInfobox = 0;
$foundImage = 0;
$foundImage = 0;
$insideInfobox = 0;


my @autoCategory;
my @autoCategory;
Line 156: Line 161:
$skipUnWiki = 0;
$skipUnWiki = 0;


if ($newLine =~ /^\{\{\ *Infobox.*/gi) {
if ($newLine =~ /^\{\{\ *Infobox.*/i) {
$newLine =~ s/^\{\{\ *Infobox.*/\{\{Infobox\ VG/gi;
push (@finalResult, '{{Infobox VG');
$foundInfobox = 1;
$foundInfobox = 1;
$insideInfobox = 1;
$skip = 1;
}
}


Line 197: Line 205:


#Purge un-used parameters
#Purge un-used parameters
if ($newLine =~ /^\|/) {
if ($insideInfobox) {
#If there was already an image listed in the original page, keep it
#If there was already an image listed in the original page, keep it
if ($newLine =~ /^\|\ *image\ *=\ *.+/gi) {
if (($newLine =~ /^\|\ *image\ *=\ *.+/gi) and ($savedImageLine ne "")) {
$foundImage = 1;
$foundImage = 1;
$skipUnWiki = 1;
$skipUnWiki = 1;
Line 250: Line 258:
if ($newLine =~ /^\}\}$/) {
if ($newLine =~ /^\}\}$/) {
if ($savedSizeLine ne "") { push (@finalResult, $savedSizeLine); }  # Saved size
if ($savedSizeLine ne "") { push (@finalResult, $savedSizeLine); }  # Saved size
if (($foundImage eq 0) and ($savedImageLine ne "")) { push (@finalResult, $savedImageLine); } # Saved image line, if wikipedia doesn't have one
if (($foundImage eq 0) and ($savedImageLine ne "")) { # Saved image line, if wikipedia doesn't have one
push (@finalResult, $savedImageLine);  
} elsif (($foundImage eq 0) and ($savedImageLine eq "")) {
push (@finalResult, '|image = [[File:{{SUBPAGENAME}}.png|' . $imageSize . 'px]]');
}
 


push (@finalResult, $newLine);
push (@finalResult, $newLine);
push (@finalResult, " ");
push (@finalResult, " ");
$skip = 1;
$skip = 1;
$insideInfobox = 0;
}
}


1,411

edits

Navigation menu