Difference between revisions of "Template:If pagename"

From Geohashing
m (Protected Template:If pagename: Highly visible template: This is a meta-template, it will become high-risk when it is used. ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
(Adding the "page" parameter. Adding {{pp-template}}.)
Line 1: Line 1:
 
<!--Check for match with full pagename
 
<!--Check for match with full pagename
-->{{#ifeq: {{{ {{FULLPAGENAME}}|x }}} | {{{ {{FULLPAGENAME}}| }}}
+
-->{{#ifeq: {{{ {{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|x }}} | {{{ {{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}| }}}
| {{{ {{FULLPAGENAME}} }}}  <!--Has data, or is empty but defined-->
+
| {{{ {{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }} }}}  <!--Has data, or is empty but defined-->
 
| <!--Else, are we on a subpage or a basepage?-->
 
| <!--Else, are we on a subpage or a basepage?-->
   {{#if:{{#titleparts:{{FULLPAGENAME}}|0|2}}
+
   {{#if:{{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|2}}
 
   | <!--We are on a subpage, check for match with "User:Somepage/"-->
 
   | <!--We are on a subpage, check for match with "User:Somepage/"-->
     {{#ifeq: {{{ {{#titleparts:{{FULLPAGENAME}}|1|1}}/|x }}} | {{{ {{#titleparts:{{FULLPAGENAME}}|1|1}}/| }}}
+
     {{#ifeq: {{{ {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|1|1}}/|x }}} | {{{ {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|1|1}}/| }}}
     | {{{ {{#titleparts:{{FULLPAGENAME}}|1|1}}/| }}}
+
     | {{{ {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|1|1}}/| }}}
 
     | <!--Check for match with "Somepage/"-->
 
     | <!--Check for match with "Somepage/"-->
       {{#ifeq: {{{ {{#titleparts:{{PAGENAME}}|1|1}}/|x }}} | {{{ {{#titleparts:{{PAGENAME}}|1|1}}/| }}}
+
       {{#ifeq: {{{ {{#titleparts:{{#if:{{{page|}}}| {{PAGENAME:{{{page|}}}}} | {{PAGENAME}} }}|1|1}}/|x }}} | {{{ {{#titleparts:{{#if:{{{page|}}}| {{PAGENAME:{{{page|}}}}} | {{PAGENAME}} }}|1|1}}/| }}}
       | {{{ {{#titleparts:{{PAGENAME}}|1|1}}/| }}}
+
       | {{{ {{#titleparts:{{#if:{{{page|}}}| {{PAGENAME:{{{page|}}}}} | {{PAGENAME}} }}|1|1}}/| }}}
 
       | <!--Check for match with "/something"-->
 
       | <!--Check for match with "/something"-->
         {{#ifeq: {{{ /{{#titleparts:{{FULLPAGENAME}}|0|2}}|x }}} | {{{ /{{#titleparts:{{FULLPAGENAME}}|0|2}}| }}}
+
         {{#ifeq: {{{ /{{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|2}}|x }}} | {{{ /{{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|2}}| }}}
         | {{{ /{{#titleparts:{{FULLPAGENAME}}|0|2}}| }}}  <!--Defined-->
+
         | {{{ /{{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|2}}| }}}  <!--Defined-->
 
         | {{{subpage| {{{other|}}} }}}  <!--Respecting empty parameter on purpose-->
 
         | {{{subpage| {{{other|}}} }}}  <!--Respecting empty parameter on purpose-->
 
         }}
 
         }}
Line 18: Line 18:
 
     }}
 
     }}
 
   | <!--We are on a basepage, check for match with "Somepage"-->
 
   | <!--We are on a basepage, check for match with "Somepage"-->
     {{#ifeq: {{{ {{PAGENAME}}|x }}} | {{{ {{PAGENAME}}| }}}
+
     {{#ifeq: {{{ {{#if:{{{page|}}}| {{PAGENAME:{{{page|}}}}} | {{PAGENAME}} }}|x }}} | {{{ {{#if:{{{page|}}}| {{PAGENAME:{{{page|}}}}} | {{PAGENAME}} }}| }}}
     | {{{ {{PAGENAME}} }}}  <!--Defined-->
+
     | {{{ {{#if:{{{page|}}}| {{PAGENAME:{{{page|}}}}} | {{PAGENAME}} }} }}}  <!--Defined-->
 
     | {{{basepage| {{{other|}}} }}}  <!--Respecting empty parameter on purpose-->
 
     | {{{basepage| {{{other|}}} }}}  <!--Respecting empty parameter on purpose-->
 
     }}
 
     }}
Line 25: Line 25:
 
}}<noinclude>
 
}}<noinclude>
  
<!-- {{pp-template}} -->
+
{{pp-template}}
 
{{documentation}}
 
{{documentation}}
 
<!-- Add categories and interwikis to the /doc subpage, not here! -->
 
<!-- Add categories and interwikis to the /doc subpage, not here! -->
 
</noinclude>
 
</noinclude>

Revision as of 02:35, 5 November 2009