User:Keller999/projects/gamepageupdate: Difference between revisions

m
Text replacement - "Gamecube" to "GameCube"
(Updated script to v1.02, please see Version 1.02 Updated)
m (Text replacement - "Gamecube" to "GameCube")
 
(33 intermediate revisions by 3 users not shown)
Line 7: Line 7:
* Remove existing non-used config variables if they are present in the page
* Remove existing non-used config variables if they are present in the page


===Scripts===
=== Scripts ===
Hooray for programming mini-project!  I put together a script that takes the Infobox and summary from Wikipedia, then the existing Dolphin Wiki article, and creates a standards-compliant merge of the two.  For an example of what this script does, please see [[Call of Duty: Black Ops/sandbox]].  Revision 23655 is before, Revision 23677 is after.  I did NOT do any additional touchup between these revs, as I wanted to show exactly what the script was doing.
Hooray for programming mini-project!  I put together a script that takes the Infobox and summary from Wikipedia, then the existing Dolphin Wiki article, and creates a standards-compliant merge of the two.  For an example of what this script does, please see [[Call of Duty: Black Ops/sandbox]].  Revision 23655 is before, Revision 23677 is after.  I did NOT do any additional touchup between these revs, as I wanted to show exactly what the script was doing.


Line 25: Line 25:
I updated the script twice, to v1.02 now.  Most of the changes are a result of bugs I've hit as I've been processing.  At some point, I may see if I can script this process JUST for article cleanup, not for new Wikipedia info.  Would have to be extremely careful and go through a lot of testing, but this is definitely an automate-able process.
I updated the script twice, to v1.02 now.  Most of the changes are a result of bugs I've hit as I've been processing.  At some point, I may see if I can script this process JUST for article cleanup, not for new Wikipedia info.  Would have to be extremely careful and go through a lot of testing, but this is definitely an automate-able process.


Did several game page updates tonight, working through [[Category:Pages using the outdated Testing template]].  Once I'm through that, I'll see how the other "Pages with..." categories and looking.  This one should at LEAST take me several nights, though. =P
Did several game page updates tonight, working through [[:Category:Pages using the outdated Testing template]].  Once I'm through that, I'll see how the other "Pages with..." categories and looking.  This one should at LEAST take me several nights, though. =P


--[[User:Keller999|Keller999]] 12:48, 20 August 2011 (CEST)
--[[User:Keller999|Keller999]] 12:48, 20 August 2011 (CEST)


:Some feedback...
:*Some pages have a section at their end for outside links (i.e. Wikipedia, Dolphin forum posts, etc.) not clear that's handled here. Such requires some cleanup as I think different section titles are used on different pages, though I believe it is consistently the last section on the page.
::*Currently anything after Gameplay Videos but before categories/nav will be lumped in with Gameplay Videos.  I'm not currently doing any processing on Gameplay Videos at all, so the entry would be preserved exactly as-is.  This may need further investigation.  Do you have a sample page?
:::*Yes...
:::**[[1080° Avalanche]] Dolphin Forum Links
:::**[[Need for Speed: Nitro]] Related Links
:::Generally, I think it would be good to include a link to the Wikipedia entry, and a Dolphin games forum link for each game (where they exist). The later would be complex to automate, but I think the former should be fairly easy. We might also want to include a link to the Issue's list in Google Code /w the game title as a search term. Section should probably be called the more generic "Related Links" to allow for the wide array of things to link in. [[User:Kolano|Kolano]] 02:59, 22 August 2011 (CEST)
::::*Perfect, I will take a look.  I will see how hard it might be to do a separate parsing of those sections.  Since the names are not consistent, I'm not sure how it will be detected, but I'll see what I can do.  As far as "Related Links", I like that idea a lot.  The easiest method would be to link to a bunch of search urls -- Wikipedia, dolphin game page forums, dolphin Google code page, and Dolphin wiki.  I'll see if I can add this, shouldn't be too hard. --[[User:Keller999|Keller999]] 04:03, 22 August 2011 (CEST)
:::::*I think they tend to have "Links" in their titles, so you can probably pick up on that.[[User:Kolano|Kolano]] 05:15, 22 August 2011 (CEST)
:*Regarding "Platforms" in the infobox, generally we're only interested in platforms supported by Dolphin (i.e. GameCube, Wii, Virtual Console systems). I'd actually prefer to omit this line, as it's confusing for titles on multiple platforms which have multiple pages on the Wiki (though it would be good to interlink the platform page pairs where they exist.
::*The script is purging any platform that is not supported by Dolphin, and then wikifying the ones that remain.  If we were to agree on a standard for how pages should be named when they are available on more than one platform, it would be easy to add a <nowiki>'This page is about the [[GameCube]] version of Super Tonka Trucks.  You may also be interested in [[Super Tonka Trucks (Wii)]].'</nowiki> to the top of the page, a la Wikipedia style.  Might also make sense to make disambiguation pages, and link to those.  Your thoughts?
:::*We more or less had decided to forgo the Platforms parameter previously, due to the confusion it could cause. A consistent naming format does exist, in the cases where a title is supported on both GameCube and Wii, two pages exist with different postfixes " (GC)" and " (Wii)". Unfortunately, since I'm unaware of any means to do text parsing within Wiki logic, I don't think a Wiki logic approach allows for resolution. The script can do the text parsing, but I'm still unsure it's worth bothering over.[[User:Kolano|Kolano]] 02:59, 22 August 2011 (CEST)
:::*Disambiguation pages for these would make sense, at least one exists for [[The Legend of Zelda: Twilight Princess]], but I don't think any of the other instances are covered.[[User:Kolano|Kolano]] 02:59, 22 August 2011 (CEST)
::::*I'll see if I can figure out a way to find games that have multiple platforms, and start creating disambig pages for them. --[[User:Keller999|Keller999]] 04:03, 22 August 2011 (CEST)
:::::*There aren't that many of them (~14), the easy way is probably to just search for them and manually generate appropriate pages. The Wii postfix search doesn't work out, as the non-parentetical use is too common, but the GameCube postfix works out better: [http://wiki.dolphin-emu.org/index.php?title=Special%3ASearch&redirs=1&search=%28GC%29&fulltext=Search&ns0=1&title=Special%3ASearch&advanced=1&fulltext=Advanced+search Titles for disambiguation (i.e. including "(GC)"]
:::*Is this ignoring unsupported platforms? I got the impression for Virtual Console titles the script was just including a full list.[[User:Kolano|Kolano]] 02:59, 22 August 2011 (CEST)
::::*Currently, Virtual Console is treated just like another supported platform -- it is included and Wikified.  If both Virtual Console and say, Nintendo 64 are listed, Nintendo 64 is getting purged.  I think the logic I would like to use is "if it has Virtual Console in the platforms, wikify and include all platforms regardless of whether they're supported by Dolphin".  On another note, does it even make sense for us to include Virtual Console titles in the wiki?  I know the devs are of the opinion that you should use an emulator for the original console, and I tend to agree with them.  There is no work that I'm aware of to improve support for Virtual Console games.  --[[User:Keller999|Keller999]] 04:03, 22 August 2011 (CEST)
:[[User:Kolano|Kolano]] 00:45, 21 August 2011 (CEST)
::*Thanks for your feedback, keep em coming.  --[[User:Keller999|Keller999]] 01:10, 21 August 2011 (CEST)


Continued feedback...
*Testing sections: I need to start discussion around this in the Testing template, but in any case, I'm considering some revisions there. You'll note I revised the testing template to start generating "Tested On" categories, at least for OS's. Such works out to some degree there, as there are a limited number of inputs, but similar methods won't work well for high variety of the current CPU/GPU sections. Follow up on such in... [[Template talk:Testing/entry]]. In any case, I may want the script to handle reparsing some of the testing fields into separate values.[[User:Kolano|Kolano]] 05:15, 22 August 2011 (CEST)


====dolphinpageupdate.pl====
=== dolphinpageupdate.pl ===
Runs great on my Linux box, uses no special modules.  I know for a fact that system('clear') does NOT work in Windows, but you could probably replace it with system('cls') and get the same effect.
Runs great on my Linux box, uses no special modules.  I know for a fact that system('clear') does NOT work in Windows, but you could probably replace it with system('cls') and get the same effect.


====Version History====
==== Version History ====
'''''1.0'''''
'''''1.0'''''
* Initial release
* Initial release
Line 52: Line 73:
* Categories are now always capitalized
* Categories are now always capitalized
* Mention of any of our supported systems in description text is now automatically Wiki-fied
* Mention of any of our supported systems in description text is now automatically Wiki-fied
'''''1.02.1'''''
* Testing section example now shows correct format
'''''1.02.2'''''
* Updated Version Compatibility user hint for the new capabilities
* Turned the automatically-generated category note into a maintenance category instead -- delete it when you've reviewed the auto-generated categories.  Auto-generated categories will still be below the special category, while existing categories are above.
'''''1.02.3'''''
* The end of the infobox from the existing page will now be more accurately detected
* Compensation for a strange copy-paste error when there's a space after the image filename
* WiiWare games will no longer be automatically categorized as Wii games too
* [[:Category:Single-player games]] is now filtered out -- I will go back and remove everything from it as well.  I figure, ALL games are single player.
* Script no longer mangles description text with the word 'Wii' in it
'''''1.02.4'''''
* Template:nihongo is now handled.  Replaced with the subpage name, since this is almost always used to give the Japanese for the game in question on Wikipedia.  Other option would be to replace with the literal translation, but that often does not match the actual game name.
* Trailing spaces no longer cause extra subheadings to be generated
'''''1.02.5'''''
* Wii with a non-space will now be properly converted into a wiki link
'''''1.02.6'''''
* Preserve spacing in existing descriptions (still needs some work, double spacing is not kept)
* Spacing adjustments
* Improvement on the default infobox (which is broken at the moment, working on that)
'''''1.02.7'''''
* Omit infobox title parameter
'''''1.02.8'''''
* Embolden title in description
* Fix for extra tester params being generated
* Keep line breaks from Wikipedia article
* Only keep the input line from the existing article if it's actually set
* Fix tester regex to stop duplications, whoops -- capture groups mistake
* Template:nihongo is better handled now
'''''1.1'''''
* Only keep all existing Infobox params if they're set
* Handle and remove 'citation needed'
'''''1.1.01'''''
* Makes |tester= optional, entries are still purged if the other params are missing (is this desirable or not?)
* Testing type entry is now kept if present.  Config type was always kept by the script, so no change needed.
* When replacing Template:nihongo, bold {{SUBPAGENAME}}


<pre>
<pre>
Line 62: Line 119:
$imageSize = 300; # Assuming Wii by default
$imageSize = 300; # Assuming Wii by default


my ($image, $savedSizeLine, $savedInputLine, $savedPlatformsLine);
my ($image, $savedSizeLine, $savedInputLine, $savedPlatformsLine, $pageType);


#######
#######
Line 69: Line 126:
system('clear');
system('clear');


print "*********************************\n";
print "************************************\n";
print "* Dolphin Wiki Page Update v1.02 *\n";
print "* Dolphin Wiki Page Update v1.1.01 *\n";
print "*********************************\n\n";
print "************************************\n\n";


print "First, copy and paste the game's Wikipedia article from the top to wherever you'd like to end the new description.  Zero input is fine.  Enter \'-1\' to indicate the end, or -2 to just get a blank template.\n\n";
print "First, copy and paste the game's Wikipedia article from the top to wherever you'd like to end the new description.  Zero input is fine.  Enter \'-1\' to indicate the end, or -2 to just get a blank template.\n\n";
Line 80: Line 137:
         chomp($line);
         chomp($line);


         if (($line ne "-1") and ($line ne "") and ($line ne "-2")) {
         if (($line ne "-1") and ($line ne "-2")) {
                 push (@wikipedia,$line);
                 push (@wikipedia,$line);
         }
         }
Line 93: Line 150:
system('clear');
system('clear');


print "*********************************\n";
print "************************************\n";
print "* Dolphin Wiki Page Update v1.0 *\n";
print "* Dolphin Wiki Page Update v1.1.01 *\n";
print "*********************************\n\n";
print "************************************\n\n";


print "Now, copy and paste the existing Dolphin wiki article to import existing information.  Zero input is fine.  Enter \'-1\' to indicate the end.\n\n";
print "Now, copy and paste the existing Dolphin wiki article to import existing information.  Zero input is fine.  Enter \'-1\' to indicate the end.\n\n";
Line 104: Line 161:
         chomp($line);
         chomp($line);


         if (($line ne "-1") and ($line ne "")) {
         if ($line ne "-1") {
                 push (@originalArticle,$line);
                 push (@originalArticle,$line);
         }
         }
Line 122: Line 179:


if    ($newLine =~ /^\{\{\ *Infobox.*/i) { $currentSection = "infobox"; $foundDolphinInfobox = 1; }
if    ($newLine =~ /^\{\{\ *Infobox.*/i) { $currentSection = "infobox"; $foundDolphinInfobox = 1; }
elsif ($newLine =~ /^\ *\={1,4}\ *Problems\ *\=*$/i) { $currentSection = "problems"; }
elsif ($newLine =~ /^\ *\={1,4}\ *Problems\ *\=*\s*$/i) { $currentSection = "problems"; }
elsif ($newLine =~ /^\ *\={1,4}\ *Configuration\ *\=*$/i) { $currentSection = "configuration"; }
elsif ($newLine =~ /^\ *\={1,4}\ *Configuration\ *\=*\s*$/i) { $currentSection = "configuration"; }
elsif ($newLine =~ /^\ *\={1,4}\ *Version Compatibility\ *\=*$/i) { $currentSection = "versionCompat"; }
elsif ($newLine =~ /^\ *\={1,4}\ *Version Compatibility\ *\=*\s*$/i) { $currentSection = "versionCompat"; }
elsif ($newLine =~ /^\ *\={1,4}\ *Testing\ *\=*$/i) { $currentSection = "testing"; }
elsif ($newLine =~ /^\ *\={1,4}\ *Testing\ *\=*\s*$/i) { $currentSection = "testing"; }
elsif ($newLine =~ /^\ *\={1,4}\ *Gameplay\ {1,}Videos\ *\=*$/i) { $currentSection = "videos"; }
elsif ($newLine =~ /^\ *\={1,4}\ *Gameplay\ {1,}Videos\ *\=*\s*$/i) { $currentSection = "videos"; }
elsif ($newLine =~ /^\ *\[\[Category\:.*\]\]$/i) { $currentSection = "categories"; }
elsif ($newLine =~ /^\ *\[\[Category\:.*\]\]$/i) { $currentSection = "categories"; }
elsif ($newLine =~ /^\ *\{\{Navigation\ .*\}\}$/i) { $currentSection = "categories"; }
elsif ($newLine =~ /^\ *\{\{Navigation\ .*\}\}$/i) { $currentSection = "categories"; }
Line 133: Line 190:
if ($newLine =~ /^\{\{\ *Infobox.*/i) {  # This is the start of the Infobox, ignore
if ($newLine =~ /^\{\{\ *Infobox.*/i) {  # This is the start of the Infobox, ignore
# ignore
# ignore
} elsif ($newLine =~ /^\}\}$/) {  # This is the end of the Infobox, change section and ignore
} elsif (($newLine =~ /^\}\}$/) or ($newLine =~ /^.*\}{4}$/)) {  # This is the end of the Infobox, change section and ignore
$currentSection = "description";
$currentSection = "description";
} else {  # We want to keep anything else in the infobox.  This is in case the user didn't give us a wikipedia article to generate a new one from
} else {  # We want to keep anything else in the infobox.  This is in case the user didn't give us a wikipedia article to generate a new one from
Line 140: Line 197:


# Now we save the image filename and size to be added onto wikipedia's infobox, if its provided
# Now we save the image filename and size to be added onto wikipedia's infobox, if its provided
if ($newLine =~ /^\|\ *image\ *=\ *.+/gi) {
if ($newLine =~ /^\|\ *image\ *=\ *(.+)/gi) {
$image = $newLine;
if ($1 =~ /\S/) {
# just keep the filename, and format  
$image = $newLine;
$image =~ s/\|image\ *\=\ *\[\[(?:File|Image)\ *\:\ *(.*?)(?:\||\]){1,2}.*/$1/i;
# just keep the filename, and format  
} elsif ($newLine =~ /^\|\ *size\ *=\ *.+/gi) {
$image =~ s/\|image\ *\=\ *\[\[(?:File|Image)\ *\:\ *(.+?\..+?)(?:\||\]|\.){1,2}.*/$1/i;
$savedSizeLine = $newLine; # saved for later
}
$savedSizeLine =~ s/^\|size\ *=\ *(.*)/\|size \=\ $1/i;
} elsif ($newLine =~ /^\|\ *size\ *=\ *(.+)/gi) {
} elsif ($newLine =~ /^\|\ *input\ *=\ *.+/gi) {
if ($1 =~ /\S/) {
$savedInputLine = $newLine; # saved for later
$savedSizeLine = $newLine; # saved for later
$savedInputLine =~ s/^\|input\ *=\ *(.*)/\|input \=\ $1/i;
$savedSizeLine =~ s/^\|size\ *=\ *(.*)/\|size \=\ $1/i;
} elsif ($newLine =~ /^\|\ *platforms{0,1}\ *=\ *.+/gi) {
}
$savedPlatformsLine = $newLine; # saved for later
} elsif ($newLine =~ /^\|\ *input\ *=\ *(.+)/gi) {
$savedPlatformsLine =~ s/^\|platforms{0,1}\ *=\ *(.*)/\|platforms \=\ $1/i;
if ($1 =~ /\S/) {
$savedInputLine = $newLine; # saved for later
$savedInputLine =~ s/^\|input\ *=\ *(.*)/\|input \=\ $1/i;
}
} elsif ($newLine =~ /^\|\ *platforms{0,1}\ *=\ *(.+)/gi) {
if ($1 =~ /\S/) {
$savedPlatformsLine = $newLine; # saved for later
$savedPlatformsLine =~ s/^\|platforms{0,1}\ *=\ *(.*)/\|platforms \=\ $1/i;
}
}
}
}
}
Line 176: Line 241:
} # Anything besides filled-out compat reports are not needed, the rest will be regenerated
} # Anything besides filled-out compat reports are not needed, the rest will be regenerated
} elsif ($currentSection eq "testing") {
} elsif ($currentSection eq "testing") {
if ($newLine =~ /^\{\{.+?\|revision\=\s*(.*?)\s*\|os\=\s*(.*?)\s*\|cpu\=\s*(.*?)\s*\|gpu\=\s*(.*?)\s*\|result\=\s*(.*?)\s*(\|tester\=\s*(.*?)\s*)?\}\}/i) {
if ($newLine =~ /\{\{.*(\|type\=.*?)\}\}/gi) {
$pageType = $1;
}
if ($newLine =~ /^\{\{.+?\|revision\=\s*(.*?)\s*\|os\=\s*(.*?)\s*\|cpu\=\s*(.*?)\s*\|gpu\=\s*(.*?)\s*\|result\=\s*(.*?)\s*(?:\|tester\=\s*(.*?)\s*?){0,1}\}\}/i) {
# Matches test reports with all variables set (tester is optional) and dissects for reassembly (muahahaha!)
# Matches test reports with all variables set (tester is optional) and dissects for reassembly (muahahaha!)
$testResult = "\{\{testing\/entry\|revision\=$1\|OS\=$2\|CPU\=$3\|GPU\=$4\|result\=$5\|tester\=".(($6)?"$6":"")."\}\}";
$testResult = "\{\{testing\/entry\|revision\=$1\|OS\=$2\|CPU\=$3\|GPU\=$4\|result\=$5\|tester\=".(($6)?"$6":"")."\}\}";
Line 240: Line 308:


#Wii
#Wii
if ($newLine =~ /.*Wii.*/i) {
if ($newLine =~ /.*Wii(\s|\||\]|\,$)/i) {
$platforms .= '[[Wii]] ';
$platforms .= '[[Wii]] ';
if (@autoCategory eq 0) { push (@autoCategory, '<!-- Categories below this line were automatically generated -->'); }
if (@autoCategory eq 0) { push (@autoCategory, '[[Category:Pages with automatically-added categories that have not been verified]]'); }
push (@autoCategory, "[[Category:Wii games]]");
push (@autoCategory, "[[Category:Wii games]]");
$platformAltered = 1;
$platformAltered = 1;
Line 251: Line 319:
                 if ($newLine =~ /GameCube/i) {
                 if ($newLine =~ /GameCube/i) {
$platforms .= '[[GameCube]] ';
$platforms .= '[[GameCube]] ';
if (@autoCategory eq 0) { push (@autoCategory, '<!-- Categories below this line were automatically generated -->'); }
if (@autoCategory eq 0) { push (@autoCategory, '[[Category:Pages with automatically-added categories that have not been verified]]'); }
push (@autoCategory, "[[Category:GameCube games]]");
push (@autoCategory, "[[Category:GameCube games]]");
$platformAltered = 1;
$platformAltered = 1;
Line 260: Line 328:
                 if ($newLine =~ /WiiWare/i) {
                 if ($newLine =~ /WiiWare/i) {
               $platforms .= '[[WiiWare]] ';
               $platforms .= '[[WiiWare]] ';
if (@autoCategory eq 0) { push (@autoCategory, '<!-- Categories below this line were automatically generated -->'); }
if (@autoCategory eq 0) { push (@autoCategory, '[[Category:Pages with automatically-added categories that have not been verified]]'); }
push (@autoCategory, "[[Category:WiiWare games]]");
push (@autoCategory, "[[Category:WiiWare games]]");
$platformAltered = 1;
$platformAltered = 1;
Line 270: Line 338:
if ($newLine =~ /.*Virtual\ *Console.*/i) {
if ($newLine =~ /.*Virtual\ *Console.*/i) {
$platforms .= '[[Virtual Console]] ';
$platforms .= '[[Virtual Console]] ';
if (@autoCategory eq 0) { push (@autoCategory, '<!-- Categories below this line were automatically generated -->'); }
if (@autoCategory eq 0) { push (@autoCategory, '[[Category:Pages with automatically-added categories that have not been verified]]'); }
push (@autoCategory, "[[Category:Virtual Console games]]");
push (@autoCategory, "[[Category:Virtual Console games]]");
$platformAltered = 1;
$platformAltered = 1;
Line 279: Line 347:
                 if ($newLine =~ /TriForce/i) {
                 if ($newLine =~ /TriForce/i) {
               $platforms .= '[[Triforce]] ';
               $platforms .= '[[Triforce]] ';
if (@autoCategory eq 0) { push (@autoCategory, '<!-- Categories below this line were automatically generated -->'); }
if (@autoCategory eq 0) { push (@autoCategory, '[[Category:Pages with automatically-added categories that have not been verified]]'); }
push (@autoCategory, "[[Category:Triforce games]]");
push (@autoCategory, "[[Category:Triforce games]]");
$platformAltered = 1;
$platformAltered = 1;
Line 292: Line 360:
#Purge un-used parameters
#Purge un-used parameters
if ($insideInfobox) {
if ($insideInfobox) {
#Replace whatever title Wikipedia is using with our own
if ($newLine =~ /^\|\ *title\ *=\ *.+/gi) {
$newLine = '|title = {{SUBPAGENAME}}';
}
# If the parameter is not in our list, it's ignored
# If the parameter is not in our list, it's ignored
if ($newLine =~ /^\|\ *(title|developer|publisher|distributor|director|producer|designer|programmer|artist|composer|license|series|engine|resolution|released|genre|mode|ratings|size|fps|dspcode|dtkadpcm|channeltype|mode|modes)\ *=\ *.{2,}/gi) {
if ($newLine =~ /^\|\ *(developer|publisher|distributor|director|producer|designer|programmer|artist|composer|license|series|engine|resolution|released|genre|mode|ratings|dspcode|dtkadpcm|channeltype|mode|modes)\ *=\ *.{2,}/gi) {
$skip = 0;
$skip = 0;
$newLine =~ s/^\|(\S*)\ *=\ *(.*)/\|$1 \= $2/i;
$newLine =~ s/^\|(\S*)\ *=\ *(.*)/\|$1 \= $2/i;
Line 310: Line 373:
$newLine =~ s/\<ref.+?\/.{0,3}\>//gi; # remove citations references
$newLine =~ s/\<ref.+?\/.{0,3}\>//gi; # remove citations references
$newLine =~ s/\{\{vgy\|([0-9]{4})\}\}/$1/gi; # we don't do Template:vgy, removing
$newLine =~ s/\{\{vgy\|([0-9]{4})\}\}/$1/gi; # we don't do Template:vgy, removing
$newLine =~ s/\{\{nihongo\|.+\}\}/\'\'\'\{\{SUBPAGENAME\}\}\'\'\'/gi; # we don't do Template:nihongo.  Since this is almost always the name of the page, replace with {{SUBPAGENAME}}
$newLine =~ s/\{\{cite.*?\}\}//gi; # remove references
$newLine =~ s/\{\{cite.*?\}\}//gi; # remove references
$newLine =~ s/\{\{Citation needed.*?\}\}//gi; # remove 'citation needed'
$newLine =~ s/\[\[(([.]|[^\|])+?)\]\]/$1/g; # un-wiki-fy wiki links in the format [[link]]
$newLine =~ s/\[\[(([.]|[^\|])+?)\]\]/$1/g; # un-wiki-fy wiki links in the format [[link]]
                 $newLine =~ s/\[\[.+?\|(.+?)\]\]/$1/g; # un-wiki-fy wiki links in the format [[link|name]]
                 $newLine =~ s/\[\[.+?\|(.+?)\]\]/$1/g; # un-wiki-fy wiki links in the format [[link|name]]
Line 322: Line 387:
@genres = split (/\,|\<br.*?\>/,$genreLine);
@genres = split (/\,|\<br.*?\>/,$genreLine);
foreach (@genres) {
foreach (@genres) {
if (@autoCategory eq 0) { push (@autoCategory, '<!-- Categories below this line were automatically generated -->'); }
if (@autoCategory eq 0) { push (@autoCategory, '[[Category:Pages with automatically-added categories that have not been verified]]'); }
$line = $_;
$line = $_;


Line 342: Line 407:
@modes = split (/\,|\<br.*?\>/,$modeLine);
@modes = split (/\,|\<br.*?\>/,$modeLine);
foreach (@modes) {
foreach (@modes) {
if (@autoCategory eq 0) { push (@autoCategory, '<!-- Categories below this line were automatically generated -->'); }
if (@autoCategory eq 0) { push (@autoCategory, '[[Category:Pages with automatically-added categories that have not been verified]]'); }
$line = $_;
$line = $_;




if ($line ne "") {
if (($line ne "") and (not($line =~ /.*single.*/i))) {
$line =~ s/(\<.+?\>)|\(|\)/\,/gi;
$line =~ s/(\<.+?\>)|\(|\)/\,/gi;
$line =~ s/^\ *//;
$line =~ s/^\ *//;
Line 356: Line 421:
}
}


#New-line if this is the end of the Infobox
if ($newLine =~ /^\}\}$/) { #this is the end of the Infobox
if ($newLine =~ /^\}\}$/) {
if ($savedSizeLine ne "") { push (@finalResult, $savedSizeLine); }  # Saved size
if ($savedSizeLine ne "") { push (@finalResult, $savedSizeLine); }  # Saved size
if ($savedInputLine ne "") { push (@finalResult, $savedInputLine); }  # Saved input
if ($savedInputLine ne "") { push (@finalResult, $savedInputLine); }  # Saved input
Line 367: Line 431:


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


#Wiki-fy some of the terms that we have on our wiki
if (($foundWikipediaInfobox eq 1) and ($skip eq 0)) {
if (($foundWikipediaInfobox eq 1) and ($skip eq 0)) {
if ($insideInfobox eq 0) {
if ($insideInfobox eq 0) {
$newLine =~ s/GameCube/[[GameCube]]/i;
$newLine =~ s/GameCube/[[GameCube]]/i;
$newLine =~ s/Nintendo GameCube/[[GameCube]]/i;
$newLine =~ s/Nintendo GameCube/[[GameCube]]/i;
$newLine =~ s/\ Wii\ /[[Wii]]/i;
$newLine =~ s/Wii(\W)/[[Wii]]$1/i;
$newLine =~ s/WiiWare/[[WiiWare]]/i;
$newLine =~ s/WiiWare/[[WiiWare]]/i;
$newLine =~ s/Virtual Console/[[Virtual Console]]/i;
$newLine =~ s/Virtual Console/[[Virtual Console]]/i;
Line 411: Line 475:
}
}


if ($compareCatShort eq $shortCat) {
if (lc($compareCatShort) eq lc($shortCat)) {
$dupe = 1;
$dupe = 1;
}
}
Line 427: Line 491:
} elsif (($foundWikipediaInfobox eq 0) and ($foundDolphinInfobox eq 0)) { # We didn't get ANY infoboxes, create a generic one
} elsif (($foundWikipediaInfobox eq 0) and ($foundDolphinInfobox eq 0)) { # We didn't get ANY infoboxes, create a generic one
push (@finalResult, '{{Infobox VG');
push (@finalResult, '{{Infobox VG');
push (@finalResult, '|title = {{SUBPAGENAME}}');
push (@finalResult, '|image = [[File:{{SUBPAGENAME}}.png|300px]]');
push (@finalResult, '|image = [[File:{{SUBPAGENAME}}.png|');
push (@finalResult, '}}');
push (@finalResult, '}}');
}
}
Line 434: Line 497:
#DESCRIPTION PROCESSING
#DESCRIPTION PROCESSING
if ((@descriptionSection) and ($foundWikipediaInfobox eq 0)) {  # Only re-use the original description if there was one and we didn't get Wikipedia data
if ((@descriptionSection) and ($foundWikipediaInfobox eq 0)) {  # Only re-use the original description if there was one and we didn't get Wikipedia data
push (@finalResult, "\n");
push (@finalResult, @descriptionSection);
push (@finalResult, @descriptionSection);
}
}


push (@finalResult, "\n\=\= Problems \=\=");
push (@finalResult, "\=\= Problems \=\=");
push (@finalResult, @problemSection);
push (@finalResult, @problemSection);


Line 449: Line 511:
push (@finalResult, "\n\=\= Version Compatibility \=\=");
push (@finalResult, "\n\=\= Version Compatibility \=\=");
push (@finalResult, "\{\{VersionCompatibility\}\}");
push (@finalResult, "\{\{VersionCompatibility\}\}");
push (@finalResult, '<!--Use this template for compatibility entries: {{VersionCompatibilityVersion|7617|****}}-->');
push (@finalResult, '<!--Use this template for compatibility entries: {{VersionCompatibilityVersion|revision|****|notes}}-->');
push (@finalResult, @versionCompatSection);
push (@finalResult, @versionCompatSection);
push (@finalResult, "\{\{VersionCompatibilityClose\}\}");
push (@finalResult, "\{\{VersionCompatibilityClose\}\}");


push (@finalResult, "\n\=\= Testing \=\=");
push (@finalResult, "\n\=\= Testing \=\=");
push (@finalResult, "\{\{testing\/start\}\}");
push (@finalResult, "\{\{testing\/start" . $pageType . "\}\}");
push (@finalResult, '<!--Use this template for test entries: {{Test Entry|revision=|OS=|CPU=|GPU=|result=|tester=}}-->');
push (@finalResult, '<!--Use this template for test entries: {{testing/entry|revision=|OS=|CPU=|GPU=|result=|tester=}}-->');
push (@finalResult, @testingSection);
push (@finalResult, @testingSection);
push (@finalResult, "\{\{testing\/end\}\}");
push (@finalResult, "\{\{testing\/end\}\}");
Line 462: Line 524:
push (@finalResult, @videoSection);
push (@finalResult, @videoSection);


push (@finalResult, "\n");
push (@finalResult, @categorySection);
push (@finalResult, @categorySection);