Template:Category handler: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(Using a #switch-case for the blacklist check, to make it easier to add more blacklist functions in the future.)
(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-->
| {{#ifeq: {{lc: {{{categories|}}} }} | no
| <!--If "data" is a number, return the corresponding
numbered parameter, else return "data"-->
| <!--"categories=no", don't categorize-->
| <!--If "data" is a number, return the corresponding
{{cat handler/numbered
numbered parameter, else return "data"-->
| 1 = {{{1|}}}
{{cat handler/numbered
| 2 = {{{2|}}}
| 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|}}}
| data =
{{#ifeq: {{lc: {{{nocat|}}} }} | false
{{#switch:
| <!--"nocat=false", force categorize, skip blacklist check-->
| {{cat handler/blacklist| page = {{{page|}}} }} <!--Check blacklist-->
{{#ifeq: {{lc: {{{nocat|}}} }} | false
| <!--"nocat=false", skip blacklist check-->
}}
| {{#ifeq: {{lc: {{{categories|}}} }} | yes
| hide = <!--Blacklist returned "hide", don't categorize-->
| <!--"categories=yes", skip blacklist check-->
| #default =
| {{cat handler/blacklist| page = {{{page|}}} }} <!--Check blacklist-->
<!--Check what namespace, and return the data for it-->
{{namespace detect
}}
| main = {{{main| {{{other| 1 }}} }}}
}}
| hide = <!--Blacklist returned "hide", don't categorize-->
| talk = {{{talk| {{{other|}}} }}}
| user = {{{user| {{{other|}}} }}}
| #default =
<!--Check what namespace, and return the data for it-->
| wikipedia = {{{wikipedia| {{{project| {{{other|}}} }}} }}}
{{namespace detect
| file = {{{file| {{{image| {{{other| 1 }}} }}} }}}
| 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, November 16, 2009

Template:Cat handler/numbered