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
|}}{{#ifeq: {{lc: <!--"{{{categories=no",|}}} don't}} categorize-->| no
| |dontcat <!--"categories=yesno", skip blacklistdon't checkcategorize-->
| <!--If "data" is a number, return the corresponding
}}{{#ifeq: {{{category|¬}}} | ¬
numbered parameter, else return "data"-->
| <!--"category = ¬" or "category" not defined-->
{{cat handler/numbered
| 1 ={{#if: {{{1category|}}}
| 2{{#ifeq: ={{lc: {{{2category|}}} }} | no
| 3 =| {{{3|}}}dontcat
| <!--"category = yes" or has other data-->
| 4 = {{{4|}}}
| 5 = {{{5|}}}
| dontcat <!--"category" is defined but empty-->
| 6 = {{{6|}}}
| 7 = {{{7|}}}
| 8 = {{{8|}}}
| <!--Don't categorise (result was "dontcat" or "dontcatdontcat" and so on)-->
| 9 = {{{9|}}}
| <!--If "data" is a number, return the corresponding
| 10 = {{{10|}}}
numbered parameter, else return "data"-->
| data =
{{cat handler/numbered
{{#switch:
| 1 = {{#ifeq: {{lc: {{{nocat1|}}} }} | false
| 2 = {{{2|}}}
| <!--"nocat=false", skip blacklist check-->
| {{#ifeq:3 {{lc:= {{{categories3|}}} }} | yes
| 4 = {{{4|}}}
| <!--"categories=yes", skip blacklist check-->
| 5 = {{{5|}}}
| 6 = {{{6|}}}
| 7 = {{{7|}}}
| 8 = {{{8|}}}
| 9 = {{{9|}}}
| 10 = {{{10|}}}
| data =
{{#switch:
{{#ifeq: {{lc: {{{nocat|}}} }} | false
| <!--"nocat=false", skip blacklist check-->
| {{#ifeq: {{lc: {{{categories|}}} }} | noyes
| <!--"categories=yes", skip blacklist check-->
| main ={{#ifeq: {{{main|lc: {{{othercategory| 1 }}} }}} | yes
| <!--"category=yes", skip blacklist check-->
| {{cat handler/blacklist| page = {{{page|}}} }} <!--Check blacklist-->
}}
}}
}}
| hide = <!--Blacklist returned "hide", don't categorize-->
| #default =
<!--Check what namespace, and return the data for it-->
<!--RespectingCheck what namespace, and return emptythe parametersdata onfor purposeit-->
<!--Respecting empty parameters on purpose-->
{{namespace detect
| main = {{{main| {{{other| 1 }}} }}}
| talkmain = {{{talkmain| {{{other| 1 }}} }}}
| usertalk = {{{usertalk| {{{other|}}} }}}
| wikipediauser = {{{wikipedia| {{{projectuser| {{{other|}}} }}} }}}
| filewikipedia = {{{filewikipedia| {{{imageproject| {{{other| 1 }}} }}} }}}
| mediawikifile = {{{mediawikifile| {{{image| {{{other| 1 }}} }}} }}}
| templatemediawiki = {{{templatemediawiki| {{{other|}}} }}}
| helptemplate = {{{helptemplate| {{{other| 1 }}} }}}
| categoryhelp = {{{categoryhelp| {{{other| 1 }}} }}}
| portalcategory = {{{portalcategory| {{{other| 1 }}} }}}
| otherportal = {{{portal| {{{other| 1 }}} <!--Namespace special or a new namespace-->}}}
| pageother = {{{pageother|}}} <!--ForNamespace special or testinga andnew demonstrationnamespace-->
| page = {{{page|}}} <!--For testing and demonstration-->
}}
}}
}}
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu