Sjabloon:Namespace detect: verschil tussen versies

Uit informatiestandaarden
Ga naar: navigatie, zoeken
(switch to Lua implementation)
 
(Nieuwe pagina aangemaakt met '{{#switch: {{lc: <!--Lower case the result--> <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} ...')
Regel 1: Regel 1:
{{#invoke:Namespace detect|main}}<noinclude>
+
{{#switch:
 +
  {{lc:              <!--Lower case the result-->
 +
    <!--If no or empty "demospace" parameter then detect namespace-->
 +
    {{#if:{{{demospace|}}}
 +
    | {{{demospace}}}
 +
    | {{#if:{{{page|}}}
 +
      | <!--Detect the namespace in the "page" parameter-->
 +
        {{#ifeq:{{NAMESPACE:{{{page}}} }}|{{TALKSPACE:{{{page}}} }}
 +
        | talk
 +
        | {{SUBJECTSPACE:{{{page}}} }}
 +
        }}
 +
      | <!--No "demospace" or "page" parameters, so detect actual namespace-->
 +
        {{#ifeq:{{NAMESPACE}}|{{TALKSPACE}}
 +
        | talk
 +
        | {{SUBJECTSPACE}}
 +
        }}
 +
      }}
 +
    }}
 +
  }}
 +
<!-- 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|}}} }}}
 +
| file
 +
| image    = {{{file| {{{image| {{{other|}}} }}} }}}
 +
| mediawiki = {{{mediawiki| {{{other|}}} }}}
 +
| template  = {{{template| {{{other|}}} }}}
 +
| help      = {{{help| {{{other|}}} }}}
 +
| category  = {{{category| {{{other|}}} }}}
 +
| portal    = {{{portal| {{{other|}}} }}}
 +
| book      = {{{book| {{{other|}}} }}}
 +
| other
 +
| #default  = {{{other|}}}  <!--"demospace=other" or a new namespace-->
 +
 
 +
}}<!--End switch--><noinclude>
  
 
{{documentation}}
 
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
+
<!-- Add categories and interwikis to the /doc subpage, not here! -->
 
</noinclude>
 
</noinclude>

Versie van 16 jul 2013 om 09:49


[aanmaken] Template documentation