Jump to content

Template:Sport table cell/doc

From Wikipedia, the free encyclopedia

Usage[edit]

This template returns blue background for a table cell, if the first parameter exists, and returns, for the table cell contents, the 1st parameter with the first and third digit swapped if there is an en dash – in the 1st parameter. If the 1st parameter does not exist and the 2nd parameter does, just the 2nd parameter is returned. If neither the 1st parameter nor the 2nd parameter exist, a grey background with contents of a period "." is returned to display an apparently blank cell.

For example,
{{Sport table cell|1–2|anything}}
returns
style="background-color:#B8C8FF"|2–1
While
{{Sport table cell|anything without –|anything}} returns style="background-color:#B8C8FF"|anything without –
While
{{Sport table cell||anything with or without –}}
returns
anything with or without –

This is intended for sports results for teams up and down and across in a table. If team parings, Tm3 at Tm1 is set to 3-0, Tm2 at Tm3 to 3/19 and all other pairings are nonexistent the following table:

{| class="wikitable" style="text-align:center;"
| ||Tm1||Tm2||Tm3
|-
|Tm1||style="background-color:#BBBBBB"| ||{{Sport table cell|{{{Tm2 at Tm1}}}|{{{Tm1 at Tm2}}}}}||{{Sport table cell|{{{Tm3 at Tm1}}}|{{{Tm1 at Tm3}}}}}
|-
|Tm2||{{Sport table cell|{{{Tm1 at Tm2}}}|{{{Tm2 at Tm1}}}}}||style="background-color:#BBBBBB"| ||{{Sport table cell|{{{Tm3 at Tm2}}}|{{{Tm2 at Tm3}}}}}
|-
|Tm3{{Sport table cell|{{{Tm1 at Tm3}}}|{{{Tm3 at Tm1}}}}}||{{Sport table cell|{{{Tm2 at Tm3}}}|{{{Tm3 at Tm2}}}}}||style="background-color:#BBBBBB"| |}

produces the following:
Note that blue is home games for teams in leftmost column.

Tm1 Tm2 Tm3
Tm1 . 0–3
Tm2 . 3/19
Tm3 3–0 3/19