Anonymous user
Template:Category handler: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Adding support for "category=empty/no/not defined/¬/yes" for backwards compatibility, to ease deployment. Unfortunately bloating the code.
(Adding a code comment.) |
(Adding support for "category=empty/no/not defined/¬/yes" for backwards compatibility, to ease deployment. Unfortunately bloating the code.) |
||
Line 1:
{{#if:
{{#ifeq: {{lc: {{{nocat|}}} }} | true
| dontcat <!--"nocat=true", don't categorize-->
| {{#ifeq: {{lc: {{{categories|}}} }} | no▼
| <!--If "data" is a number, return the corresponding ▼
}}{{#ifeq: {{{category|¬}}} | ¬
numbered parameter, else return "data"-->▼
| <!--"category = ¬" or "category" not defined-->
{{cat handler/numbered▼
|
| <!--"category = yes" or has other data-->
| 4 = {{{4|}}}▼
| dontcat <!--"category" is defined but empty-->
| 6 = {{{6|}}}▼
| <!--Don't categorise (result was "dontcat" or "dontcatdontcat" and so on)-->
| 9 = {{{9|}}}▼
| 10 = {{{10|}}}▼
| data = ▼
{{#switch:▼
| 1
| 2 = {{{2|}}}
| <!--"nocat=false", skip blacklist check-->▼
▲ | <!--"categories=yes", skip blacklist check-->
| 5 = {{{5|}}}
| 7 = {{{7|}}}
| 8 = {{{8|}}}
{{#ifeq: {{lc: {{{nocat|}}} }} | false
| <!--"categories=yes", skip blacklist check-->
| <!--"category=yes", skip blacklist check-->
| {{cat handler/blacklist| page = {{{page|}}} }} <!--Check blacklist-->
}}
}}
<!--Respecting empty parameters on purpose-->
▲ | main = {{{main| {{{other| 1 }}} }}}
| page = {{{page|}}} <!--For testing and demonstration-->
▲ }}
}}
}}
|