Template:Cat: Difference between revisions

From ChoralWiki
Jump to navigation Jump to search
(test making 2nd argument optional (duplicates 1st argument if 2nd omitted))
(new Cat template, one required, two optional parameters now)
Line 1: Line 1:
[[Category:{{{1}}}]][[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]<noinclude>[[Category:Templates|{{PAGENAME}}]]</noinclude>
[[Category:{{{1}}}|{{{3|}}}]][[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]<noinclude>[[Category:Templates|{{PAGENAME}}]]</noinclude><noinclude><br><br><div><div style="margin: 0; margin-right: 30px; margin-left: 30px; border: 1px solid #3399ff; padding: 1em 1em 1em 1em; background-color:#ddffdd">
<center><big>'''Documentation'''</big></center>
 
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).
 
'''Syntax, with the one required paramter:'''
: <tt><nowiki>{{Cat|<category name>}}</nowiki></tt>
which is equivalent to inserting
: <tt><nowiki>[[Category:<category name>|]][[:Category:<category name>|<category name>]]</nowiki></tt>
into a file, and the link is displayed as:
 
<font color=blue><category name></font>
 
'''Syntax, with required and first optional parameters:'''
: <tt><nowiki>{{Cat|<category name>|<displayed text>}}</nowiki></tt>
or
: <tt><nowiki>{{Cat|<category name>|2=<displayed text>}}</nowiki></tt>
either of which is equivalent to inserting
: <tt><nowiki>[[Category:<category name>|]][[:Category:<category name>|<displayed text>]]</nowiki></tt>
into a file and is displayed as:
 
<font color=blue><displayed text></font>
 
For example,
: <tt><nowiki>{{Cat|German texts|Texte auf Deutsch}}</nowiki></tt>
results in the link being displayed as:
 
<font color=blue>Texte auf Deutsch</font>
 
'''Syntax, with required and both optional parameters (for advanced users):'''
: <tt><nowiki>{{Cat|<category name>|<displayed text>|<sort key>}}</nowiki></tt>
or
: <tt><nowiki>{{Cat|<category name>|2=<displayed text>|3=<sort key>}}</nowiki></tt>
either of which is equivalent to inserting
: <tt><nowiki>[[Category:<category name>|<sort key>]][[:Category:<category name>|<displayed text>]]</nowiki></tt>
into a file.  The category <category name> is referenced with the <sort key>, and the link displayed as:
 
<font color=blue><displayed text></font>
 
</div>
</noinclude>

Revision as of 08:13, 5 March 2008

[[Category:{{{1}}}|]][[: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).

Syntax, with the one required paramter:

{{Cat|<category name>}}

which is equivalent to inserting

[[Category:<category name>|]][[:Category:<category name>|<category name>]]

into a file, and the link is displayed as:

<category name>

Syntax, with required and first optional parameters:

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

or

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

either of which is equivalent to inserting

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

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>|<sort key>}}

or

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

either of which is equivalent to inserting

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

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

<displayed text>