Difference between revisions of "Template:Cat"

From ChoralWiki
Jump to navigation Jump to search
(add category to discriminate usage of 3=<sort key>)
(change sort key parameter to 9=<sort key>)
Line 1: Line 1:
[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]<includeonly>[[Category:{{{1}}}|{{{9|{{PAGENAME}}}}}]][[Category:good-bad|{{{3|*{{PAGENAME}}}}}]]</includeonly><noinclude>[[Category:Templates|{{PAGENAME}}]]</noinclude><noinclude><br>
+
[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]<includeonly>[[Category:{{{1}}}]]</includeonly><noinclude>[[Category:Templates|{{PAGENAME}}]]</noinclude><noinclude><br>
 
{{prot-temp}}<br>
 
{{prot-temp}}<br>
 
<div><div style="margin: 0; margin-right: 30px; margin-left: 30px; border: 1px solid #3399ff; padding: 1em 1em 1em 1em; background-color:#ddffdd">
 
<div><div style="margin: 0; margin-right: 30px; margin-left: 30px; border: 1px solid #3399ff; padding: 1em 1em 1em 1em; background-color:#ddffdd">
Line 31: Line 31:
  
 
'''Syntax, with required and both optional parameters (for advanced users):'''
 
'''Syntax, with required and both optional parameters (for advanced users):'''
: <tt><nowiki>{{Cat|<category name>|<displayed text>|<sort key>}}</nowiki></tt>
+
: <tt><nowiki>{{Cat|<category name>|<displayed text>|9=<sort key>}}</nowiki></tt>
or
+
</nowiki></tt>
: <tt><nowiki>{{Cat|<category name>|2=<displayed text>|3=<sort key>}}</nowiki></tt>
+
which is equivalent to inserting
either of which is equivalent to inserting
 
 
: <tt><nowiki>[[:Category:<category name>|<displayed text>]][[Category:<category name>|<sort key>]]</nowiki></tt>
 
: <tt><nowiki>[[:Category:<category name>|<displayed text>]][[Category:<category name>|<sort key>]]</nowiki></tt>
 
into a file.  The category <category name> is referenced with the <sort key>, and the link displayed as:
 
into a file.  The category <category name> is referenced with the <sort key>, and the link displayed as:

Revision as of 07:04, 3 May 2008

[[:Category:{{{1}}}|{{{1}}}]]


Documentation

This template simultaneously categorizes a page in a category and provides a link to that category. It has one required parameter (the target category) and up to two optional parameters (one providing an alternate way of displaying the link, the other for providing a sort key for the categorization). It extends the previous usage/syntax of Template:Cat (making it unnecessary to change existing invocations of the template).

Syntax, with the one required paramter:

{{Cat|<category name>}}

which is equivalent to inserting

[[:Category:<category name>|<category name>]][[Category:<category name>|{{PAGENAME}}]]

into a file, and the link is displayed as:

<category name>

Syntax, with required and first optional parameters:

{{Cat|<category name>|<displayed text>}}

(note this is exactly the same as the previous syntax of Template:Cat) or

{{Cat|<category name>|2=<displayed text>}}

either of which is equivalent to inserting

[[:Category:<category name>|<displayed text>]][[Category:<category name>{{PAGENAME}}|{{PAGENAME}}]]

into a file and is displayed as:

<displayed text>

For example,

{{Cat|German texts|Texte auf Deutsch}}

results in the link being displayed as:

Texte auf Deutsch

Syntax, with required and both optional parameters (for advanced users):

{{Cat|<category name>|<displayed text>|9=<sort key>}}

</nowiki> which is equivalent to inserting

[[:Category:<category name>|<displayed text>]][[Category:<category name>|<sort key>]]

into a file. The category <category name> is referenced with the <sort key>, and the link displayed as:

<displayed text>