Template:Category handler: Difference between revisions

Making this template backwards compatible by adding support for "categories=no/yes", to ease deployment.
(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:
{{#ifeq: {{lc: {{{nocat|}}} }} | true
| <!--"nocat=true", don't categorize-->
| {{#ifeq: {{lc: {{{nocatcategories|}}} }} | falseno
| <!--If "data" is a number, return the corresponding
| numbered parameter<!--"categories=no", elsedon't return "data"categorize-->
| <!--If "data" is a number, return the corresponding
{{cat handler/numbered
numbered parameter, else return "data"-->
| 1 = {{{1|}}}
{{cat handler/numbered
| 2 = {{{2|}}}
| 31 = {{{31|}}}
| 42 = {{{42|}}}
| 53 = {{{53|}}}
| 64 = {{{64|}}}
| 75 = {{{75|}}}
| 86 = {{{86|}}}
| 97 = {{{97|}}}
| 108 = {{{108|}}}
| data9 = {{{9|}}}
| 10 = {{#switch:{10|}}}
| #default data =
{{#ifeq: {{lc: {{{nocat|}}} }} | false
{{#switch:
| <!--"nocat=false", force categorize, skip blacklist check-->
| {{cat#ifeq: handler/blacklist| page ={{lc: {{{pagenocat|}}} }} | <!--Check blacklist-->false
| <!--"nocat=false", force categorize, skip blacklist check-->
}}
| file =| {{{file|#ifeq: {{{image|lc: {{{othercategories| 1 }}} }}} }}}| 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#default = {{{user| {{{other|}}} }}}
<!--Check what namespace, and return the data for it-->
| wikipedia = {{{wikipedia| {{{project| {{{other|}}} }}} }}}
{{namespace detect
| file = {{{file| {{{image| {{{other| 1 }}} }}} }}}
| mediawikimain = {{{mediawikimain| {{{other| 1 }}} }}}
| templatetalk = {{{templatetalk| {{{other|}}} }}}
| helpuser = {{{helpuser| {{{other| 1 }}} }}}
| categorywikipedia = {{{categorywikipedia| {{{otherproject| 1{{{other|}}} }}} }}}
| portalfile = {{{portalfile| {{{image| {{{other| 1 }}} }}} }}}
| othermediawiki = {{{mediawiki| {{{other|}}} <!--Namespace special or a new namespace-->}}}
| pagetemplate = {{{pagetemplate| {{{other|}}} <!--For testing and demonstration-->}}}
| talkhelp = {{{talkhelp| {{{other| 1 }}} }}}
| wikipediacategory = {{{wikipediacategory| {{{projectother| {{{other|}}}1 }}} }}}
| portal = {{{portal| {{{other| 1 }}} }}}
| other = {{{other|}}} <!--Namespace special or a new namespace-->
| page = {{{page|}}} <!--For testing and demonstration-->
| 1 = {{{1|} }}
}}
}}