Difference between revisions of "Template:Category handler"

From Ava Zinn Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
(Blacklist check moved outside {{/numbered}}. Added "basic usage check", so parameter 1 can behave normally when advanced usage. Added the evil "all" parameter that categorizes in all namespaces.)
 
(16 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
{{#if:
 
{{#if:
 
   {{#ifeq: {{lc: {{{nocat|}}} }} | true
 
   {{#ifeq: {{lc: {{{nocat|}}} }} | true
   | dontcat     <!--"nocat=true", don't categorize-->
+
   | dontcat   <!--"nocat=true", don't categorize-->
 
   }}{{#ifeq: {{lc: {{{categories|}}} }} | no
 
   }}{{#ifeq: {{lc: {{{categories|}}} }} | no
   | dontcat  <!--"categories=no", don't categorize-->
+
   | dontcat
   }}{{#switch: {{lc: {{{category|¬}}} }}
+
  }}{{#switch: {{lc: {{{category2|¬}}} }}
   | no             <!--"category = no"-->
+
  | yes
   |   = dontcat   <!--"category =", defined but empty-->
+
  | ¬  =  <!--Not defined-->
  }}  <!--Else "category = ¬" or not defined or "yes" or other data-->
+
  | #default = dontcat  <!--"category2 = no/'defined but empty'/'anything'"-->
 +
   }}{{#switch: {{lc: {{{subpage|}}} }}
 +
   | no =
 +
    {{basepage subpage
 +
    |
 +
    | dontcat    <!--"subpage=no" and on a subpage-->
 +
    | page = {{{page|}}}  <!--For testing-->
 +
    }}
 +
   | only =  
 +
    {{basepage subpage
 +
    | dontcat   <!--"subpage=only" and not on a subpage-->
 +
    | page = {{{page|}}}  <!--For testing-->
 +
    }}
 +
  }}
  
 
|  <!--Don't categorise (result was "dontcat" or "dontcatdontcat" and so on)-->
 
|  <!--Don't categorise (result was "dontcat" or "dontcatdontcat" and so on)-->
Line 15: Line 28:
 
     |  <!--"nocat=false", skip blacklist check-->
 
     |  <!--"nocat=false", skip blacklist check-->
 
     | {{#ifeq: {{lc: {{{categories|}}} }} | yes
 
     | {{#ifeq: {{lc: {{{categories|}}} }} | yes
       |  <!--"categories=yes", skip blacklist check-->
+
       |  <!--Skip blacklist check-->
       | {{#ifeq: {{lc: {{{category|}}} }} | yes
+
       | {{#ifeq: {{lc: {{{category2|}}} }} | yes
         |  <!--"category=yes", skip blacklist check-->
+
         |  <!--Skip blacklist check-->
 
         | {{cat handler/blacklist| page = {{{page|}}} }}  <!--Check blacklist-->
 
         | {{cat handler/blacklist| page = {{{page|}}} }}  <!--Check blacklist-->
 
         }}
 
         }}
Line 25: Line 38:
 
   | #default  =  
 
   | #default  =  
 
     <!--Check if any namespace parameter is defined-->
 
     <!--Check if any namespace parameter is defined-->
     {{#ifeq: h0#384!5nea+w9 | {{{all| {{{main| {{{talk| {{{user| {{{wikipedia| {{{file| {{{mediawiki| {{{template| {{{help| {{{category| {{{portal| {{{other| h0#384!5nea+w9 }}} }}} }}} }}} }}} }}} }}} }}} }}} }}} }}} }}}
+
     {{#ifeq: h0#384!5nea+w9 | {{{all| {{{main| {{{talk| {{{user| {{{wikipedia| {{{file| {{{mediawiki| {{{template| {{{help| {{{category| {{{portal| {{{book| {{{other| h0#384!5nea+w9 }}} }}} }}} }}} }}} }}} }}} }}} }}} }}} }}} }}} }}}
 
     | <!--No namespace parameters fed, basic usage-->
 
     | <!--No namespace parameters fed, basic usage-->
 
       {{namespace detect
 
       {{namespace detect
Line 33: Line 46:
 
       | category = {{{1|}}}
 
       | category = {{{1|}}}
 
       | portal = {{{1|}}}
 
       | portal = {{{1|}}}
 +
      | book = {{{1|}}}
 
       | page = {{{page|}}}  <!--For testing and demonstration-->
 
       | page = {{{page|}}}  <!--For testing and demonstration-->
 
       }}
 
       }}
Line 63: Line 77:
 
         | category = {{{category| {{{other|}}} }}}
 
         | category = {{{category| {{{other|}}} }}}
 
         | portal = {{{portal| {{{other|}}} }}}
 
         | portal = {{{portal| {{{other|}}} }}}
 +
        | book = {{{book| {{{other|}}} }}}
 
         | other = {{{other|}}}  <!--Namespace special or a new namespace-->
 
         | other = {{{other|}}}  <!--Namespace special or a new namespace-->
 
         | page = {{{page|}}}  <!--For testing and demonstration-->
 
         | page = {{{page|}}}  <!--For testing and demonstration-->

Latest revision as of 06:29, 15 March 2016


Documentation icon Template documentation[create]