Difference between revisions of "Template:Categorizer"

From Twinsuniverse
Jump to: navigation, search
m
m (forgot to remove manual categorization)
 
(42 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<includeonly>{{
 
<includeonly>{{
#ifeq: {{{article|}}} |
+
#ifeq: {{lc:{{{nocat|false}}}}} | false | {{
|{{
+
     #if:{{{category|}}}
     #if: {{{label|}}}
+
     | {{#if: {{#varexists: infobox_messages}}
     | {{{label}}}
+
        | {{#vardefine: infobox_messages | {{#var: infobox_messages|}}[[Category:{{{category}}}]]}}
    | ''missing article'' {{#ifeq: {{lc:{{SUBJECTSPACE}}}} | template | [[Category:Categorizers missing an article]] }} }}
+
        | [[Category:{{{category}}}]] }} }}}}{{
|{{
+
#ifeq: {{lc:{{{display|true}}}}} | true
    #if: {{{label|}}}
+
| {{categorylink
    | [[{{{article}}}|{{{label}}}]]
+
    |category={{{category|}}}
    | [[{{{article}}}]] }} }}{{
+
    |catlabel={{{catlabel|}}}
#if: {{{category|}}}
+
    |article={{{article|}}}
| {{superlink|article=:Category:{{{category}}}|label={{{catlabel|list all}}} }}
+
     |label={{{label|{{{article|}}}}}}}}
nc={{{nocat}}};
+
}}</includeonly><noinclude>{{Infobox Template
  {{
+
|purpose=infobox
     #ifeq: {{lc: {{{nocat|false}}} }} | false | [[Category:{{{category}}}]] }}
+
|singletag=no
| {{superlink|label=missing category}} {{#ifeq: {{lc:{{SUBJECTSPACE}}}} | template | [[Category:Categorizers missing a category]] }}
+
|multiline=no
}}</includeonly><noinclude>
+
|gamerelated=no
This template is used to add a tag to an infobox, labeling and automatically categorize the article under a category. A [[Template:Superlink|superlink]] is used to render a link to the target category.
+
|suppressible=yes
 +
|choice=single
 +
|cat1=!''by parameter '''category'''''
 +
|var1=infobox_messages!Infobox!active
 +
}}
  
:<nowiki>{{categorizer</nowiki> | category = ''category name'' | catlabel = ''displayed text on categorylink'' | article = ''an article about the category'' | label = ''displayed text on articlelink'' }}
+
This template is used in articles to automatically categorize them under a category, and to display a representation of the category. The display is in the form of a {{templatelink|categorylink}}. This display may also be turned off to merely categorize an article.
 +
 
 +
When this is used in an infobox, this will append the categorization to a variable, to allow the infobox to sort its categories. When the display is then turned off, in which case this template would make sure there is no output, the related row may gracefully collapse rather than showing empty.
  
 
==Parameters==
 
==Parameters==
* '''category''': The target category to add this article to.
+
* '''category''': The category name to use for the {{templatelink|categorylink}} and categorization (case sensitive, mandatory)
* '''catlabel''': The text to display on the categorylink (defaults to "list all").
+
* '''catlabel''', '''article''' and '''label''': Additional parameters for the {{templatelink|categorylink}}.
* '''article''': The article that represents the target category (defaults to the label not to become linked).
+
* '''display''': Whether or not to display anything (case insensitive, defaults to "true")
* '''label''': The text to display on the link to the article (defaults to the article pagename).
+
 
* '''nocat''': Whether or not to suppress categorization under '''''category''''' (defaults to false, which means auto categorization).
 
* '''nocat''': Whether or not to suppress categorization under '''''category''''' (defaults to false, which means auto categorization).
 +
 +
 +
'''''Note''': The '''display''' parameter should only be specified if it's actually used, as it also activates on the empty value.''
  
 
==Syntax==
 
==Syntax==
 +
Common use includes these four parameters:
 
  <nowiki>{{categorizer
 
  <nowiki>{{categorizer
  |category =
+
  |category=
  |catlabel =
+
  |catlabel=
  |article =
+
  |article=
  |label =
+
  |label=
|nocat =
+
 
}}</nowiki>
 
}}</nowiki>
  
 
==Examples==
 
==Examples==
Common use of the categorizer includes both '''category''' and '''article''' parameters:
+
For explanation of the above first four parameters, see {{templatelink|categorylink}}.
<nowiki>{{categorizer|category = Quetches|article = Quetch}}</nowiki>
+
  
:[[Quetch]]{{superlink|article=:Category:Quetches|label=list all}}
+
You may remove the display of the categorylink by specifying any other value than "true" for the '''display''' parameter, so these all have the same result (nothing displayed, but still categorized):
(and the page would be categorized under [[:Category:Quetches]])
+
<nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=}}</nowiki>
 +
<nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=    }}</nowiki>
 +
<nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=false}}</nowiki>
 +
<nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=nope}}</nowiki>
 +
<nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=yes}}</nowiki>
 +
<nowiki>{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=all}}</nowiki>
  
 +
Note that adding the value "true" to the '''nocat''' parameter to any of the above examples results in exactly the same as not calling this template.
  
Both the displayed texts on the category and article links can be customized using the '''catlabel''' and '''label''' parameters respectively:
+
{{stub}}
<nowiki>{{categorizer
+
|category = Quetches
+
|catlabel = list members
+
|article = Quetch
+
|label = Men
+
}}</nowiki>
+
  
:[[Quetch|Men]]{{superlink|article=:Category:Quetches|label=list members}}
+
The '''nocat''' parameter may be used to suppress automatic categorization like this (any value will do):
(and the page would be categorized under [[:Category:Quetches]])
+
 
+
 
+
If the '''article''' parameter is left out, the categorizer won't render a link on the '''label''':
+
<nowiki>{{categorizer|category = Quetches|label = Men}}</nowiki>
+
 
+
:Men{{superlink|article=:Category:Quetches|label=list all}}
+
(and the page would be categorized under [[:Category:Quetches]])
+
 
+
 
+
If both the '''article''' and '''label''' parameters are left out, the categorizer will render error text like this:
+
<nowiki>{{categorizer|category = Quetches}}</nowiki>
+
 
+
:''missing article''{{superlink|article=:Category:Quetches|label=list all}}
+
(and the page would be categorized under [[:Category:Quetches]], and templates would be categorized under [[:Category:Categorizers missing an article]])
+
 
+
 
+
If the '''category''' parameter is left out, regardless of parameter '''catlabel''', the categorizer will render like this:
+
 
  <nowiki>{{categorizer
 
  <nowiki>{{categorizer
  |catlabel = list members
+
  |category=Quetches
  |article = Quetch
+
  |article=Quetch
  |label = Men
+
  |nocat=true
 
}}</nowiki>
 
}}</nowiki>
 
:[[Quetch|Men]]{{superlink|label=missing category}}
 
(and the page would '''not''' be categorized automatically, and templates would be categorized under [[:Category:Categorizers missing a category]])
 
 
 
The '''nocat''' parameter may be used to suppress automatic categorization like this (any value will do):
 
<nowiki>{{categorizer|category = Quetches|article = Quetch|nocat = true}}</nowiki>
 
  
 
:[[Quetch]]{{superlink|article=:Category:Quetches|label=list all}}
 
:[[Quetch]]{{superlink|article=:Category:Quetches|label=list all}}
(and the page would '''not''' be categorized under [[:Category:Quetches]])
+
This would prevent the page from being categorized under [[:Category:Quetches]], which is useful if you only want to render the categorylink without categorization, and if using the {{templatelink|categorylink}} directly is not desired/possible (i.e. when calling this template indirectly).
  
[[Category:System Templates]]</noinclude>
+
</noinclude>

Latest revision as of 21:18, 4 June 2014

Categorizer
Purpose

Infobox [list all]

Single tag

No [list all]

Multi-line

No [list all]

Protected

No [list all]

Game related

No [list all]

Categorization
Suppressible

Yes [list all]

Choice

Single category [list all]

Categories

One: [list all]

  • by parameter category
Variables
Names

One: [list all]

Subpages

This template is used in articles to automatically categorize them under a category, and to display a representation of the category. The display is in the form of a {{categorylink}}. This display may also be turned off to merely categorize an article.

When this is used in an infobox, this will append the categorization to a variable, to allow the infobox to sort its categories. When the display is then turned off, in which case this template would make sure there is no output, the related row may gracefully collapse rather than showing empty.

Parameters

  • category: The category name to use for the {{categorylink}} and categorization (case sensitive, mandatory)
  • catlabel, article and label: Additional parameters for the {{categorylink}}.
  • display: Whether or not to display anything (case insensitive, defaults to "true")
  • nocat: Whether or not to suppress categorization under category (defaults to false, which means auto categorization).


Note: The display parameter should only be specified if it's actually used, as it also activates on the empty value.

Syntax

Common use includes these four parameters:

{{categorizer
 |category=
 |catlabel=
 |article=
 |label=
}}

Examples

For explanation of the above first four parameters, see {{categorylink}}.

You may remove the display of the categorylink by specifying any other value than "true" for the display parameter, so these all have the same result (nothing displayed, but still categorized):

{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=}}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=     }}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=false}}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=nope}}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=yes}}
{{categorizer|category=Quetch characters|catlabel=|article=|label=|display=all}}

Note that adding the value "true" to the nocat parameter to any of the above examples results in exactly the same as not calling this template.


  This article is a stub [list all]. You can help the Twinsuniverse by expanding it.

The nocat parameter may be used to suppress automatic categorization like this (any value will do):

{{categorizer
 |category=Quetches
 |article=Quetch
 |nocat=true
}}
Quetch [list all]

This would prevent the page from being categorized under Category:Quetches, which is useful if you only want to render the categorylink without categorization, and if using the {{categorylink}} directly is not desired/possible (i.e. when calling this template indirectly).