Template:If pagename and Template:Namespace detect: Difference between pages

From nonlocal pde
(Difference between pages)
Jump to navigation Jump to search
imported>RayAYang
m (1 revision: Wikipedia citation templates)
 
imported>WOSlinker
(remove {{pp-template}} since included in {{documentation}})
 
Line 1: Line 1:
{{#if:x   <!--Remove surrounding whitespace-->
{{#switch:
| <!--Check for match with full pagename-->
   {{lc:              <!--Lower case the result-->
  {{{ {{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}  <!--Has data, or is empty but defined-->
    <!--If no or empty "demospace" parameter then detect namespace-->
  | <!--Check for match with "User:Somepage/+"-->
    {{#if:{{{demospace|}}}  
    {{{ {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|1|1}}/+
    | {{{demospace}}}
    | <!--Else, are we on a subpage or a basepage?-->
    | {{#if:{{{page|}}}  
      {{#if:{{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|2}}
      | <!--Detect the namespace in the "page" parameter-->
       | <!--We are on a subpage, check for match with "User:Somepage/*"-->
        {{#ifeq:{{NAMESPACE:{{{page}}} }}|{{TALKSPACE:{{{page}}} }}
         {{{ {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|1|1}}/*
        | talk
        | <!--Check for match with "Somepage/*"-->
        | {{SUBJECTSPACE:{{{page}}} }}  
          {{{ {{#titleparts:{{#if:{{{page|}}}| {{PAGENAME:{{{page|}}}}} | {{PAGENAME}} }}|1|1}}/*
        }}
          | <!--Check for match with "/something"-->
       | <!--No "demospace" or "page" parameters, so detect actual namespace-->
            {{{ /{{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}}
         {{#ifeq:{{NAMESPACE}}|{{TALKSPACE}}
            | <!--Check for match with "/somethin*"-->
        | talk
              {{{ /{{lc: {{padleft:|8| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}}# }} }}*
        | {{SUBJECTSPACE}}
              | <!--Check for match with "/someth*"-->
        }}
                {{{ /{{lc: {{padleft:|6| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}}# }} }}*
      }}
                | <!--Check for match with "/some*"-->
    }}
                  {{{ /{{lc: {{padleft:|4| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}}# }} }}*  <!--Pad with # so "/a" doesn't match "/aaaa*"-->
  }}
                  | {{{subpage| {{{other|}}} }}}   <!--Respecting empty parameter on purpose-->
<!-- Only one of the lines below will be executed -->
                  }}}
<!-- Respecting empty parameters on purpose -->
                }}}
| main        <!--"demospace=main" or {{SUBJECTSPACE}}={{ns:0}}=""-->
              }}}
|          = {{{main| {{{other|}}} }}}
            }}}
| talk      = {{{talk| {{{other|}}} }}}
          }}}
| user      = {{{user| {{{other|}}} }}}
        }}}
| wikipedia = {{{wikipedia| {{{other|}}} }}}
      | <!--We are on a basepage, check for match with "Somepage"-->
| file
        {{{ {{#if:{{{page|}}}| {{PAGENAME:{{{page|}}}}} | {{PAGENAME}} }}
| image    = {{{file| {{{image| {{{other|}}} }}} }}}
        | {{{basepage| {{{other|}}} }}}  <!--Respecting empty parameter on purpose-->
| mediawiki = {{{mediawiki| {{{other|}}} }}}
        }}}
| template  = {{{template| {{{other|}}} }}}
      }}   <!--End if, are we on a subpage or a basepage?-->
| help      = {{{help| {{{other|}}} }}}
    }}}
| category  = {{{category| {{{other|}}} }}}
  }}}
| portal    = {{{portal| {{{other|}}} }}}
}}<noinclude>
| book      = {{{book| {{{other|}}} }}}
| other
| #default  = {{{other|}}}  <!--"demospace=other" or a new namespace-->
 
}}<!--End switch--><noinclude>


{{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 13:40, 4 October 2010


[create] File:Template-info.svg Template documentation