Template:Category handler: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Davidgothberg
Using a #switch-case for the blacklist check, to make it easier to add more blacklist functions in the future.
meta>Davidgothberg
Making this template backwards compatible by adding support for "categories=no/yes", to ease deployment.
Line 1: Line 1:
{{#ifeq: {{lc: {{{nocat|}}} }} | true
{{#ifeq: {{lc: {{{nocat|}}} }} | true
| <!--"nocat=true", don't categorize-->
|   <!--"nocat=true", don't categorize-->
| <!--If "data" is a number, return the corresponding  
| {{#ifeq: {{lc: {{{categories|}}} }} | no
      numbered parameter, else return "data"-->
  |  <!--"categories=no", don't categorize-->
  {{cat handler/numbered
  | <!--If "data" is a number, return the corresponding  
  | 1 = {{{1|}}}
        numbered parameter, else return "data"-->
  | 2 = {{{2|}}}
    {{cat handler/numbered
  | 3 = {{{3|}}}
    | 1 = {{{1|}}}
  | 4 = {{{4|}}}
    | 2 = {{{2|}}}
  | 5 = {{{5|}}}
    | 3 = {{{3|}}}
  | 6 = {{{6|}}}
    | 4 = {{{4|}}}
  | 7 = {{{7|}}}
    | 5 = {{{5|}}}
  | 8 = {{{8|}}}
    | 6 = {{{6|}}}
  | 9 = {{{9|}}}
    | 7 = {{{7|}}}
  | 10 = {{{10|}}}
    | 8 = {{{8|}}}
  | data =  
    | 9 = {{{9|}}}
    {{#switch:
    | 10 = {{{10|}}}
      {{#ifeq: {{lc: {{{nocat|}}} }} | false
    | data =  
      | <!--"nocat=false", force categorize, skip blacklist check-->
      {{#switch:
      | {{cat handler/blacklist| page = {{{page|}}} }}  <!--Check blacklist-->
        {{#ifeq: {{lc: {{{nocat|}}} }} | false
      }}
        |   <!--"nocat=false", skip blacklist check-->
    | hide = <!--Blacklist returned "hide", don't categorize-->
        | {{#ifeq: {{lc: {{{categories|}}} }} | yes
    | #default  =  
          |  <!--"categories=yes", skip blacklist check-->
      <!--Check what namespace, and return the data for it-->
          | {{cat handler/blacklist| page = {{{page|}}} }}  <!--Check blacklist-->
      {{namespace detect
          }}
      | main = {{{main| {{{other| 1 }}} }}}
        }}
      | talk = {{{talk| {{{other|}}} }}}
      | hide = <!--Blacklist returned "hide", don't categorize-->
      | user = {{{user| {{{other|}}} }}}
      | #default  =  
      | wikipedia = {{{wikipedia| {{{project| {{{other|}}} }}} }}}
        <!--Check what namespace, and return the data for it-->
      | file = {{{file| {{{image| {{{other| 1 }}} }}} }}}
        {{namespace detect
      | mediawiki = {{{mediawiki| {{{other|}}} }}}
        | main = {{{main| {{{other| 1 }}} }}}
      | template = {{{template| {{{other|}}} }}}
        | talk = {{{talk| {{{other|}}} }}}
      | help = {{{help| {{{other| 1 }}} }}}
        | user = {{{user| {{{other|}}} }}}
      | category = {{{category| {{{other| 1 }}} }}}
        | wikipedia = {{{wikipedia| {{{project| {{{other|}}} }}} }}}
      | portal = {{{portal| {{{other| 1 }}} }}}
        | file = {{{file| {{{image| {{{other| 1 }}} }}} }}}
      | other = {{{other|}}}  <!--Namespace special or a new namespace-->
        | mediawiki = {{{mediawiki| {{{other|}}} }}}
      | page = {{{page|}}}  <!--For testing and demonstration-->
        | template = {{{template| {{{other|}}} }}}
        | help = {{{help| {{{other| 1 }}} }}}
        | category = {{{category| {{{other| 1 }}} }}}
        | portal = {{{portal| {{{other| 1 }}} }}}
        | other = {{{other|}}}  <!--Namespace special or a new namespace-->
        | page = {{{page|}}}  <!--For testing and demonstration-->
        }}
       }}
       }}
     }}
     }}

Revision as of 17:02, 16 November 2009

Template:Cat handler/numbered