Template:Infobox VG/sandbox: Difference between revisions

Try outputting categories with their links to avoid repeated regexp checks
No edit summary
(Try outputting categories with their links to avoid repeated regexp checks)
Line 10: Line 10:
|es=background:#f0f0f0;
|es=background:#f0f0f0;
|{{#if:{{{channeltype|}}}| {{!}} '''Type''' {{!!}} {{{channeltype|}}}}}
|{{#if:{{{channeltype|}}}| {{!}} '''Type''' {{!!}} {{{channeltype|}}}}}
|{{#if:{{{developer|}}}|{{!}}'''Developer(s)'''{{!!}}{{#ifeq:{{#regex:{{{developer|}}}|/>/rs|}}||
|{{#if:{{{developer|}}}|{{!}}'''Developer(s)'''{{!!}}{{#ifeq:{{#regex:{{{developer|}}}|/>/rs|}}||
<!--List-->{{#regex:{{{developer|}}}|/([^,]+)(,? ?)/rs|[[:Category:Developed by $1|$1]]$2}}|
<!--List-->{{#regex:{{{developer|}}}|/([^,]+)(,? ?)/rs|[[Category:Developed by $1|$1]][[:Category:Developed by $1|$1]]$2}}|
<!--Regional List-->{{#regex:{{{publisher|}}}|/({{#regex:{{{publisher|}}}|/.*?(?:NA{{!}}JP{{!}}EU{{!}}AUS{{!}}KO{{!}}RUS).*?>.*?>\s*([^\[]*).*?>/rs|$1{{!}}}}#NOMATCH#)/rs|[[:Category:Developed by $1|$1]]}}}}
<!--Regional List-->{{#regex:{{{publisher|}}}|/({{#regex:{{{publisher|}}}|/.*?(?:NA{{!}}JP{{!}}EU{{!}}AUS{{!}}KO{{!}}RUS).*?>.*?>\s*([^\[]*).*?>/rs|$1{{!}}}}#NOMATCH#)/rs|[[Category:Developed by $1|$1]][[:Category:Developed by $1|$1]]}}}}
}}
}}
|{{#if:{{{publisher|}}}|{{!}}'''Publisher(s)'''{{!!}}{{#ifeq:{{#regex:{{{publisher|}}}|/>/rs|}}||
|{{#if:{{{publisher|}}}|{{!}}'''Publisher(s)'''{{!!}}{{#ifeq:{{#regex:{{{publisher|}}}|/>/rs|}}||
<!--List-->{{#regex:{{{publisher|}}}|/([^,]+)(,? ?)/rs|[[:Category:Published by $1|$1]]$2}}|
<!--List-->{{#regex:{{{publisher|}}}|/([^,]+)(,? ?)/rs|[[Category:Published by $1|$1]][[:Category:Published by $1|$1]]$2}}|
<!--Regional List-->{{#regex:{{{publisher|}}}|/({{#regex:{{{publisher|}}}|/.*?(?:NA{{!}}JP{{!}}EU{{!}}AUS{{!}}KO{{!}}RUS).*?>.*?>\s*([^\[]*).*?>/rs|$1{{!}}}}#NOMATCH#)/rs|[[:Category:Published by $1|$1]]}}}}
<!--Regional List-->{{#regex:{{{publisher|}}}|/({{#regex:{{{publisher|}}}|/.*?(?:NA{{!}}JP{{!}}EU{{!}}AUS{{!}}KO{{!}}RUS).*?>.*?>\s*([^\[]*).*?>/rs|$1{{!}}}}#NOMATCH#)/rs|[[Category:Published by $1|$1]][[:Category:Published by $1|$1]]}}}}
}}
}}
 
|{{#if:{{{series|}}}|{{!}} '''*Series''' {{!!}}{{#regex: {{#regex: {{{series|}}}|/''/|}}|/([^,]+)(,? ?)/rs|[[:Category:$1 series|$1]]$2}}}}
|<!--Series Category Links-->{{#if:{{{series|}}}|{{!}} '''*Series''' {{!!}}{{#regex: {{#regex: {{{series|}}}|/''/|}}|/([^,]+)(,? ?)/rs|[[:Category:$1 series|$1]]$2}}}}
 
|{{#if:{{{platform|{{{platforms|}}}}}}| {{!}} '''Platform(s)''' {{!!}} {{{platform|{{{platforms|}}}}}}}}
|{{#if:{{{platform|{{{platforms|}}}}}}| {{!}} '''Platform(s)''' {{!!}} {{{platform|{{{platforms|}}}}}}}}
|{{#if:{{{released|{{{release|}}}}}}| {{!}} {{nowrap|'''Release date(s)'''}} {{!!}} {{{released|{{{release}}}}}}}}
|{{#if:{{{released|{{{release|}}}}}}| {{!}} {{nowrap|'''Release date(s)'''}} {{!!}} {{{released|{{{release}}}}}}}}
 
|{{#if:{{{genre|}}}|{{!}}'''Genre(s)'''{{!!}}{{#regex: {{#regex: {{{genre|}}}|/''/|}}|/([^,]+)(,? ?)/rs|[[:Category:$1 games|$1]]$2}}}}
|<!--Genre category links (up to 16)-->{{#if:{{{genre|}}}|{{!}}'''Genre(s)'''{{!!}}<!--1st-->{{#regex: {{{genre|}}}|/([^,]*).*/rs|[[:Category:$1 games|$1]]|1}}<!--2nd-->{{#regex: {{{genre|}}}|/[^,]*,([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--3rd-->{{#regex: {{{genre|}}}|/(?:[^,]*,){2}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--4th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){3}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--5th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){4}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--6th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){5}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--7th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){6}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--8th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){7}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--9th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){8}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--10th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){9}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}
<!--11th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){10}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--12th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){11}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--13th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){12}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--14th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){13}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--15th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){14}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}<!--16th-->{{#regex: {{{genre|}}}|/(?:[^,]*,){15}([^,]*)(,.*)?/rs|, [[:Category:$1 games|$1]]|1}}}}
 
|<!--Genre category links-->{{#if:{{{genre|}}}|{{!}}'''Genre(s)'''{{!!}}{{#regex: {{#regex: {{{genre|}}}|/''/|}}|/([^,]+)(,? ?)/rs|[[:Category:$1 games|$1]]$2}}}}


|<!--Gameplay mode category links-->{{#if:{{{mode|{{{modes|}}}}}}|{{!}}'''Mode(s)'''{{!!}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Ss]ingle.*/|Single-player}}|Single-player|[[:Category:Single-player games|Single-player]]|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Mm]ultiplayer.*/|Multiplayer}}|Multiplayer|{{#ifeq:{{#regex:{{{modes|}}}|/.*[Ss]ingle.*/|Prior}}|Prior|, |}} [[:Category:Multiplayer games|Multiplayer]]{{#regex:{{{modes|}}}|/.*[Mm]ultiplayer([^,]*).*/|$1}}|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Cc]o-[oO]p.*/|Co-op}}|Co-op|{{#ifeq:{{#regex:{{{modes|}}}|/.*([Ss]ingle{{!}}[Mm]ultiplayer).*/|Prior}}|Prior|, |}} [[:Category:Co-op games|Co-op]]{{#regex:{{{modes|}}}|/.*[Cc]o-op([^,]*).*/|$1}}|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Oo]nline.*/|Online}}|Online|{{#ifeq:{{#regex:{{{modes|}}}|/.*([Ss]ingle{{!}}[Mm]ultiplayer{{!}}[Cc]o-op).*/|Prior}}|Prior|, |}} [[:Category:Online games|Online]]{{#regex:{{{modes|}}}|/.*[Oo]nline([^,]*).*/|$1}}|}}}}
|<!--Gameplay mode category links-->{{#if:{{{mode|{{{modes|}}}}}}|{{!}}'''Mode(s)'''{{!!}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Ss]ingle.*/|Single-player}}|Single-player|[[:Category:Single-player games|Single-player]]|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Mm]ultiplayer.*/|Multiplayer}}|Multiplayer|{{#ifeq:{{#regex:{{{modes|}}}|/.*[Ss]ingle.*/|Prior}}|Prior|, |}} [[:Category:Multiplayer games|Multiplayer]]{{#regex:{{{modes|}}}|/.*[Mm]ultiplayer([^,]*).*/|$1}}|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Cc]o-[oO]p.*/|Co-op}}|Co-op|{{#ifeq:{{#regex:{{{modes|}}}|/.*([Ss]ingle{{!}}[Mm]ultiplayer).*/|Prior}}|Prior|, |}} [[:Category:Co-op games|Co-op]]{{#regex:{{{modes|}}}|/.*[Cc]o-op([^,]*).*/|$1}}|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Oo]nline.*/|Online}}|Online|{{#ifeq:{{#regex:{{{modes|}}}|/.*([Ss]ingle{{!}}[Mm]ultiplayer{{!}}[Cc]o-op).*/|Prior}}|Prior|, |}} [[:Category:Online games|Online]]{{#regex:{{{modes|}}}|/.*[Oo]nline([^,]*).*/|$1}}|}}}}
|<!--Should output category links here, but complicated by + syntax-->{{#if:{{{input|}}}| {{!}} '''Input methods''' {{!!}} {{{input|}}}}}
|<!--Should output category links here, but complicated by + syntax-->{{#if:{{{input|}}}| {{!}} '''Input methods''' {{!!}} {{{input|}}}}}
|{{!}} '''Compatibility''' {{!!}} {{ratings|{{#if:{{{nonerror|}}}|nonerror=true{{!}}|}}{{PAGENAME}}}}
|{{!}} '''Compatibility''' {{!!}} {{ratings|{{#if:{{{nonerror|}}}|nonerror=true{{!}}|}}{{PAGENAME}}}}
|{{!}} '''See also...''' {{!!}}
|{{!}} '''See also...''' {{!!}}
{{#if:{{#regex:{{PAGENAME}}|/.*(\)).*/|}}||{{#ifexist:{{#regex:{{PAGENAME}}|/(.+)\((?!Arcade).+\)/|$1}} (Arcade)|[[{{#regex:{{PAGENAME}}|/(.+)\(.+\)/|$1}} (Arcade)|Arcade Version]]<br />
{{#if:{{#regex:{{PAGENAME}}|/.*(\)).*/|}}||
{{#ifexist:{{#regex:{{PAGENAME}}|/(.+)\((?!Arcade).+\)/|$1}} (Arcade)|[[{{#regex:{{PAGENAME}}|/(.+)\(.+\)/|$1}} (Arcade)|Arcade Version]]<br />
}}{{#ifexist:{{#regex:{{PAGENAME}}|/(.+)\((?!C64).+\)/|$1}} (C64)|[[{{#regex:{{PAGENAME}}|/(.+)\(.+\)/|$1}} (C64)|C64 Version]]<br />
}}{{#ifexist:{{#regex:{{PAGENAME}}|/(.+)\((?!C64).+\)/|$1}} (C64)|[[{{#regex:{{PAGENAME}}|/(.+)\(.+\)/|$1}} (C64)|C64 Version]]<br />
}}{{#ifexist:{{#regex:{{PAGENAME}}|/(.+)\((?!Genesis).+\)/|$1}} (Genesis)|[[{{#regex:{{PAGENAME}}|/(.+)\(.+\)/|$1}} (Genesis)|Genesis Version]]<br />
}}{{#ifexist:{{#regex:{{PAGENAME}}|/(.+)\((?!Genesis).+\)/|$1}} (Genesis)|[[{{#regex:{{PAGENAME}}|/(.+)\(.+\)/|$1}} (Genesis)|Genesis Version]]<br />
Line 57: Line 49:


Data Quality Categories-->{{#ifeq:{{#regex:{{{modes|}}}|/.*(Single-Player).*/|$1}}|Single-Player|[[Category:Game pages with mis-capitalized Single-player]]|}}{{#if:{{{compatibility|}}}|[[Category:Pages with an un-needed compatibility param in InfoBox]]|}}{{#if:{{{released|}}}{{{release|}}}||[[Category:Game pages without release date(s)]]}}{{#if:{{{forumlink|}}}||[[Category:Game pages without Dolphin forum link]]}}{{#if:{{{genre|}}}||[[Category:Game pages without genre]]}}{{#if:{{{modes|}}}||{{#ifeq:{{{genre|}}}|Utility||[[Category:Game pages without modes of play]]}}}}{{#if:{{{input|}}}||[[Category:Game pages without possible inputs]]}}{{#if: {{{series|}}}|{{#if:{{#regex: {{{series|}}}|/''/rs||1}}||[[Category:Game pages with non-italic series]]}}}}{{#ifeq:{{#regex:{{{input|}}}|/.*(Gamecube).*/|$1}}|Gamecube|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(controller).*/|$1}}|controller|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(wii).*/|$1}}|wii|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(Balance board).*/|$1}}|Balance board|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(nunchuk).*/|$1}}|nunchuk|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(balance board).*/|$1}}|balance board|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(Wiimote).*/|$1}}|Wiimote|[[Category:Game page with Wiimote rather than Wii Remote]]|}}<!--
Data Quality Categories-->{{#ifeq:{{#regex:{{{modes|}}}|/.*(Single-Player).*/|$1}}|Single-Player|[[Category:Game pages with mis-capitalized Single-player]]|}}{{#if:{{{compatibility|}}}|[[Category:Pages with an un-needed compatibility param in InfoBox]]|}}{{#if:{{{released|}}}{{{release|}}}||[[Category:Game pages without release date(s)]]}}{{#if:{{{forumlink|}}}||[[Category:Game pages without Dolphin forum link]]}}{{#if:{{{genre|}}}||[[Category:Game pages without genre]]}}{{#if:{{{modes|}}}||{{#ifeq:{{{genre|}}}|Utility||[[Category:Game pages without modes of play]]}}}}{{#if:{{{input|}}}||[[Category:Game pages without possible inputs]]}}{{#if: {{{series|}}}|{{#if:{{#regex: {{{series|}}}|/''/rs||1}}||[[Category:Game pages with non-italic series]]}}}}{{#ifeq:{{#regex:{{{input|}}}|/.*(Gamecube).*/|$1}}|Gamecube|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(controller).*/|$1}}|controller|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(wii).*/|$1}}|wii|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(Balance board).*/|$1}}|Balance board|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(nunchuk).*/|$1}}|nunchuk|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(balance board).*/|$1}}|balance board|[[Category:Game page with improperly capitalized inputs]]|}}{{#ifeq:{{#regex:{{{input|}}}|/.*(Wiimote).*/|$1}}|Wiimote|[[Category:Game page with Wiimote rather than Wii Remote]]|}}<!--
Developer categories-->{{#if:{{{developer|}}}|{{#ifeq:{{#regex:{{{developer|}}}|/>/rs|}}||<!--1st-->{{#regex:{{{developer|}}}|/([^,]*).*/rs|[[Category:Developed by $1]]|1}}<!--2nd-->{{#regex:{{{developer|}}}|/[^,]*,([^,]*)(,.*)?/rs|[[Category:Developed by $1]]|1}}<!--3rd-->{{#regex:{{{developer|}}}|/(?:[^,]*,){2}([^,]*)(,.*)?/rs|[[Category:Developed by $1]]|1}}|<!--NA-->{{#regex:{{{developer|}}}|/.*?NA.*?>.*?>\s*([^\[]*).*/r|[[Category:Developed by $1]]|1}}<!--EU-->{{#regex:{{{developer|}}}|/.*?EU.*?>.*?>([^/[]*).*/r|[[Category:Developed by $1]]|1}}<!--JP-->{{#regex:{{{developer|}}}|/.*?JP.*?>.*?>([^/[]*).*/r|[[Category:Developed by $1]]|1}}<!--AUS-->{{#regex:{{{developer|}}}|/.*?AUS.*?>.*?>([^/[]*).*/r|[[Category:Developed by $1]]|1}}}}}}<!--
Publisher categories: regional ones are outputting as text rather than as categories for some reason, seems to have something to do with the replacement used.-->{{#if:{{{publisher|}}}|{{#ifeq:{{#regex:{{{publisher|}}}|/>/rs|}}||<!--1st-->{{#regex:{{{publisher|}}}|/([^,]*).*/rs|[[Category:Published by $1]]|1}}<!--2nd-->{{#regex:{{{publisher|}}}|/[^,]*,([^,]*)(,.*)?/rs|[[Category:Published by $1]]|1}}<!--3rd-->{{#regex:{{{publisher|}}}|/(?:[^,]*,){2}([^,]*)(,.*)?/rs|[[Category:Published by]]|1}}|<!--NA-->{{#regex:{{{publisher|}}}|/.*?NA.*?>.*?>\s*([^\[]*).*/r|[[Category:Published by $1]]|1}}<!--EU-->{{#regex:{{{publisher|}}}|/.*?EU.*?>.*?>\s*([^\[]*).*/r|[[Category:Published by $1]]|1}}<!--JP-->{{#regex:{{{publisher|}}}|/.*?JP.*?>.*?>\s*([^\[]*).*/r|[[Category:Published by $1]]|1}}<!--AUS-->{{#regex:{{{publisher|}}}|/.*?AUS.*?>.*?>\s*([^\[]*).*/r|[[Category:Published by $1]]|1}}}}}}<!--


Gameplay mode categories-->{{#ifeq:{{#regex:{{{modes|}}}|/.*[Mm]ultiplayer.*/|Found}}|Found|[[Category:Multiplayer games]]|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Cc]o-[oO]p.*/|Found}}|Found|[[Category:Multiplayer games]][[Category:Co-op games]]|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Ss]ingle-[pP]layer.*/|Found}}|Found|[[Category:Single-player games]]{{#ifeq:{{#regex:{{{modes|}}}|/[Ss]ingle-[pP]layer/|Single-player}}|Single-Player|[[Category:Single-player only games]]|}}|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Oo]nline.*/|Found}}|Found|[[Category:Online games]]|}}<!--
Gameplay mode categories-->{{#ifeq:{{#regex:{{{modes|}}}|/.*[Mm]ultiplayer.*/|Found}}|Found|[[Category:Multiplayer games]]|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Cc]o-[oO]p.*/|Found}}|Found|[[Category:Multiplayer games]][[Category:Co-op games]]|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Ss]ingle-[pP]layer.*/|Found}}|Found|[[Category:Single-player games]]{{#ifeq:{{#regex:{{{modes|}}}|/[Ss]ingle-[pP]layer/|Single-player}}|Single-Player|[[Category:Single-player only games]]|}}|}}{{#ifeq:{{#regex:{{{modes|}}}|/.*[Oo]nline.*/|Found}}|Found|[[Category:Online games]]|}}<!--