User:Keller999/projects/gamepageupdate: Difference between revisions
Jump to navigation
Jump to search
(dolphinpageupdate.pl v1.02.8) |
(dolphinpageupdate.pl v1.1 -- getting pretty stable now) |
||
Line 98: | Line 98: | ||
* Embolden title in description | * Embolden title in description | ||
* Fix for extra tester params being generated | * Fix for extra tester params being generated | ||
* Keep line breaks from Wikipedia article | * Keep line breaks from Wikipedia article | ||
* Only keep the input line from the existing article if it's actually set | * Only keep the input line from the existing article if it's actually set | ||
* Fix tester regex to stop duplications, whoops -- capture groups mistake | * Fix tester regex to stop duplications, whoops -- capture groups mistake | ||
* Template:nihongo is better handled now | * Template:nihongo is better handled now | ||
'''''1.1''''' | |||
* Only keep all existing Infobox params if they're set | |||
* Handle and remove 'citation needed' | |||
<pre> | <pre> | ||
Line 120: | Line 122: | ||
system('clear'); | system('clear'); | ||
print " | print "*********************************\n"; | ||
print "* Dolphin Wiki Page Update v1. | print "* Dolphin Wiki Page Update v1.1 *\n"; | ||
print " | 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 144: | Line 146: | ||
system('clear'); | system('clear'); | ||
print " | print "*********************************\n"; | ||
print "* Dolphin Wiki Page Update v1. | print "* Dolphin Wiki Page Update v1.1 *\n"; | ||
print " | 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 191: | Line 193: | ||
# 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/) { | ||
$image = $newLine; | |||
# just keep the filename, and format | |||
} elsif ($newLine =~ /^\|\ *size\ *=\ *.+/gi) { | $image =~ s/\|image\ *\=\ *\[\[(?:File|Image)\ *\:\ *(.+?\..+?)(?:\||\]|\.){1,2}.*/$1/i; | ||
$savedSizeLine = $newLine; # saved for later | } | ||
} elsif ($newLine =~ /^\|\ *size\ *=\ *(.+)/gi) { | |||
if ($1 =~ /\S/) { | |||
$savedSizeLine = $newLine; # saved for later | |||
$savedSizeLine =~ s/^\|size\ *=\ *(.*)/\|size \=\ $1/i; | |||
} | |||
} elsif ($newLine =~ /^\|\ *input\ *=\ *(.+)/gi) { | } elsif ($newLine =~ /^\|\ *input\ *=\ *(.+)/gi) { | ||
if ($1 =~ /\S/) { | if ($1 =~ /\S/) { | ||
Line 203: | Line 209: | ||
$savedInputLine =~ s/^\|input\ *=\ *(.*)/\|input \=\ $1/i; | $savedInputLine =~ s/^\|input\ *=\ *(.*)/\|input \=\ $1/i; | ||
} | } | ||
} elsif ($newLine =~ /^\|\ *platforms{0,1}\ *=\ *.+/gi) { | } elsif ($newLine =~ /^\|\ *platforms{0,1}\ *=\ *(.+)/gi) { | ||
$savedPlatformsLine = $newLine; # saved for later | if ($1 =~ /\S/) { | ||
$savedPlatformsLine = $newLine; # saved for later | |||
$savedPlatformsLine =~ s/^\|platforms{0,1}\ *=\ *(.*)/\|platforms \=\ $1/i; | |||
} | |||
} | } | ||
} | } | ||
Line 360: | Line 368: | ||
$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/\{\{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 509: | Line 518: | ||
push (@finalResult, @videoSection); | push (@finalResult, @videoSection); | ||
push (@finalResult, @categorySection); | push (@finalResult, @categorySection); | ||