Jump to content

User:Ham105/sandbox/p23

From Wikipedia, the free encyclopedia

This template is for including medal symbols in sporting event result tables, while preserving the ability for sort.

Template series

[edit]

The first group of templates show medal images while giving a table sort of 01, 02 or 03, respectively.

The second group of templates are show medal images with display text of either Gold, Silver, Bronze. These also give a table sort of 01, 02 or 03, respectively.

Usage

[edit]

Simply insert the template where you would like to see the symbol. No parameters are required.

Sorting will work numerically unless the column contains any non-numeric text, in which case a text sort will occur (e.g. "10" is before "3"). The templates automatically use 01, 02 and 03 as the sorting. To get the desired sort results for other numbers it may be necessary to use the {{sort}} template to specify appropriate sort keys to be inserted as hidden text in front of the displayed values. For example, {{sort|9|DQ}} displays "DQ" but sorts using "9 DQ".

Parameters

[edit]

The first unnamed parameter can be used to resize the medal image.

Example, 20px high:

  • {{bronze3|20px}}, will display as: 3rd place, bronze medalist(s)

The parameter defaults to null, which will produce a medal of the image's native size (16px high and 16px wide).


The link parameter can be used to pass a link to an article to {{sort}}.

Example:

  • {{gold1|link=article name}}

It defaults to null.

Examples

[edit]
  • For example, the following code using two digit sorting...
{| class="wikitable sortable" style="text-align:center"
|-
! Rank !! Place !! Bad Sort
|-
| {{Gold01|12px}} || First || 1
|-
| {{Silver02|12px}} || Second || 2
|-
| {{Bronze03|12px}} || Third || 3
|-
| {{Sort|04|4}} || Fourth || {{sort|04|4}}
|-
| {{Sort|05|5}} || Fifth || {{Sort|05|5}}
|-
| 10 || Tenth || 10
|-
| 11 || Eleventh  || 11
|-
| 20 || Twentieth || 20
|-
| 50 || Fiftieth || 50
|-
| {{Sort|98|NM}} || No mark || NM
|-
| {{Sort|99|DQ}} || Disqualified || DQ
|}

...will display as:

Rank Place Bad Sort
1st place, gold medalist(s) First 1
2nd place, silver medalist(s) Second 2
3rd place, bronze medalist(s) Third 3
4 Fourth 4
5 Fifth 5
10 Tenth 10
11 Eleventh 11
20 Twentieth 20
50 Fiftieth 50
NM No mark NM
DQ Disqualified DQ
  • Image size of medals may affect row heights if larger than adjacent text...
<div style="float: left; width: 9em;">

{|class="wikitable" style="text-align:center;font-size:85%;"
|-
! Medal !! Place
|-
| None || Fourth
|-
| {{User:Ham105/sandbox/p22|20px}} || Third
|-
| {{User:Ham105/sandbox/p22|20px}} || Second
|-
| {{gold medal|20px}} || First
|}

</div><div style="float: left; width: 9em;">

{|class="wikitable" style="text-align:center;font-size:85%;"
|-
! Medal !! Place
|-
| None || Fourth
|-
| {{User:Ham105/sandbox/p22|15px}} || Third
|-
| {{User:Ham105/sandbox/p22|15px}} || Second
|-
| {{gold medal|15px}} || First
|}

</div>

... too big (left); matching text (right)

Medal Place
None Fourth
link= Third
link= Second
 Gold First
Medal Place
None Fourth
link= Third
link= Second
 Gold First