Template:Table cell templates/doc: Difference between revisions
meta>Crissov |
meta>Thumperward tidy this up |
||
Line 1: | Line 1: | ||
<noinclude>{{Documentation subpage}}</noinclude> | <noinclude>{{Documentation subpage}}</noinclude> | ||
The templates in this series are designed to be used in a [[Help:Table|table]] to make a cell with text in that cell, with an appropriately coloured background. They are commonly used in [[:Category:Comparisons|comparison tables]]. | The templates in this series are designed to be used in a [[Help:Table|table]] to make a cell with text in that cell, with an appropriately coloured background. They are commonly used in [[:Category:Comparisons|comparison tables]]. | ||
For example, <code>{{tl|yes}}</code> makes a cell with a green background. The text in the cell is taken from the [[Help:Template#Parameters|first parameter]]; <code><nowiki>{{</nowiki>yes|Sure}}</code> would output "Sure" otherwise it defaults to "Yes". Most templates allow authors to override the default text in this way, some require text put after the template call and some also need a vertical bar in between: <code><nowiki>{{</nowiki>''table cell template''}} ''text''</code> or <code><nowiki>{{</nowiki>''table cell template''}} | ''text''</code>. This information, the colors and default texts are found in the table below. | For example, <code>{{tl|yes}}</code> makes a cell with a green background. The text in the cell is taken from the [[Help:Template#Parameters|first parameter]]; <code><nowiki>{{</nowiki>yes|Sure}}</code> would output "Sure" otherwise it defaults to "Yes". Most templates allow authors to override the default text in this way, some require text put after the template call and some also need a vertical bar in between: <code><nowiki>{{</nowiki>''table cell template''}} ''text''</code> or <code><nowiki>{{</nowiki>''table cell template''}} | ''text''</code>. This information, the colors and default texts are found in the table below. | ||
If you want to use other attributes for the table cells, e.g. <code>colspan</code> or <code>rowspan</code>, they need to be put before the template call and there must be no vertical bar <code>|</code> in between them: | If you want to use other attributes for the table cells, e.g. <code>colspan</code> or <code>rowspan</code>, they need to be put before the template call and there must be no vertical bar <code>|</code> in between them: | ||
{| class=wikitable align=right | {| class=wikitable align=right | ||
!{{Yes}} ||{{No}} ||rowspan=2 {{n/a}} | !{{Yes}} ||{{No}} ||rowspan=2 {{n/a}} | ||
Line 11: | Line 12: | ||
|colspan=2 {{Yes-No}} | |colspan=2 {{Yes-No}} | ||
|} | |} | ||
<pre> | <pre>... | ||
!{{Yes}} ||{{No}} ||rowspan=2 {{n/a}} | !{{Yes}} ||{{No}} ||rowspan=2 {{n/a}} | ||
|- | |- | ||
|colspan=2 {{Yes-No}} | |colspan=2 {{Yes-No}} | ||
... | |||
</pre> | </pre> | ||
== Templates in this series == | === Templates in this series === | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ Table cell templates | |+ Table cell templates | ||
Line 29: | Line 31: | ||
| <code>table-yes</code> || {{tl|yes}}, {{tlp|yes|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{yes}} ||{{yes|Alternative [[Plain text|text]]}} | | <code>table-yes</code> || {{tl|yes}}, {{tlp|yes|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{yes}} ||{{yes|Alternative [[Plain text|text]]}} | ||
|- | |- | ||
|rowspan=2| <code>table-no</code> || {{tl|no}}, {{tlp|no|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{no}} ||{{no|Alternative [[Plain text|text]]}} | |rowspan=2| <code>table-no</code> || {{tl|no}}, {{tlp|no|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{no}} ||{{no|Alternative [[Plain text|text]]}} | ||
|- | |- | ||
| {{tl|coming soon}} || {{coming soon}} || | | {{tl|coming soon}} || {{coming soon}} || | ||
Line 69: | Line 71: | ||
| {{tl|unk}} || {{unk}} || | | {{tl|unk}} || {{unk}} || | ||
|- | |- | ||
| <code>table-depends</code> || {{tl|depends}}, {{tlp|depends|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{depends}}|| {{depends|Alternative [[Plain text|text]]}} | | <code>table-depends</code> || {{tl|depends}}, {{tlp|depends|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{depends}}|| {{depends|Alternative [[Plain text|text]]}} | ||
|- | |- | ||
| <code>table-included</code> || {{tl|included}} || {{included}} || | | <code>table-included</code> || {{tl|included}} || {{included}} || | ||
Line 81: | Line 83: | ||
| {{tl|table-experimental}} || {{table-experimental}} || | | {{tl|table-experimental}} || {{table-experimental}} || | ||
|- | |- | ||
| <code>table-free</code> || {{tl|free}}, {{tlp|free|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{free}} ||{{free|Alternative [[Plain text|text]]}} | | <code>table-free</code> || {{tl|free}}, {{tlp|free|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{free}} ||{{free|Alternative [[Plain text|text]]}} | ||
|- | |- | ||
| <code>table-nonfree</code> || {{tl|nonfree}}, {{tlp|nonfree|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{nonfree}}|| {{nonfree|Alternative [[Plain text|text]]}} | | <code>table-nonfree</code> || {{tl|nonfree}}, {{tlp|nonfree|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{nonfree}}|| {{nonfree|Alternative [[Plain text|text]]}} | ||
|- | |- | ||
| <code>table-proprietary</code> || {{tl|proprietary}}, {{tlp|proprietary|<nowiki>Alternative [[Plain text|text]]</nowiki>}} ||{{proprietary}} || {{proprietary|Alternate [[Plain text|text]]}} | | <code>table-proprietary</code> || {{tl|proprietary}}, {{tlp|proprietary|<nowiki>Alternative [[Plain text|text]]</nowiki>}} ||{{proprietary}} || {{proprietary|Alternate [[Plain text|text]]}} | ||
|- | |- | ||
| <code>table-needs</code> || {{tl|needs}}, {{tlp|needs|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{needs}} ||{{needs|Alternative [[Plain text|text]]}} | | <code>table-needs</code> || {{tl|needs}}, {{tlp|needs|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{needs}} ||{{needs|Alternative [[Plain text|text]]}} | ||
|- | |- | ||
| ''no class'' || {{tl|incorrect}}, {{tlp|incorrect|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{incorrect}} ||{{incorrect|Alternative [[Plain text|text]]}} | | ''no class'' || {{tl|incorrect}}, {{tlp|incorrect|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{incorrect}} ||{{incorrect|Alternative [[Plain text|text]]}} | ||
|- | |- | ||
| ''no class'' || {{tl|no result}}, {{tlp|no result|N.R.}} || {{No result}} || {{No result|N.R.}} | | ''no class'' || {{tl|no result}}, {{tlp|no result|N.R.}} || {{No result}} || {{No result|N.R.}} | ||
|- | |- | ||
| ''no class'' || {{tl|pending}} || {{Pending}} || | | ''no class'' || {{tl|pending}} || {{Pending}} || | ||
|- | |- | ||
| <code>table-nightly</code> || {{tl|nightly}}, {{tlp|nightly|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{nightly}}|| {{nightly|Alternative [[Plain text|text]]}} | | <code>table-nightly</code> || {{tl|nightly}}, {{tlp|nightly|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{nightly}}|| {{nightly|Alternative [[Plain text|text]]}} | ||
|- | |- | ||
| <code>table-release-candidate</code> || {{tl|release-candidate}}, {{tlp|release-candidate|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{release-candidate}}|| {{release-candidate|Alternative [[Plain text|text]]}} | | <code>table-release-candidate</code> || {{tl|release-candidate}}, {{tlp|release-candidate|<nowiki>Alternative [[Plain text|text]]</nowiki>}} || {{release-candidate}}|| {{release-candidate|Alternative [[Plain text|text]]}} | ||
|- | |- | ||
| ''no class'' || {{tl|?}}<ref name="table-cell-templates-table-noparam">Does not take a parameter; not really a table cell template at all, but here for completeness</ref> || {{?}} || | | ''no class'' || {{tl|?}}<ref name="table-cell-templates-table-noparam">Does not take a parameter; not really a table cell template at all, but here for completeness</ref> || {{?}} || | ||
Line 104: | Line 106: | ||
|} | |} | ||
== Code == | === Code === | ||
Common code to most if not all the templates in this series: | Common code to most if not all the templates in this series: | ||
< | |||
<pre style="overflow: auto"> | |||
{{Table cell templates|class=''automatic''|text=''text''|bg=#''abcdef''}} | |||
</pre> | |||
Code specific to this template: | Code specific to this template: | ||
< | <pre style="overflow: auto"> | ||
{{ {{BASEPAGENAME}} }} | |||
</pre> | |||
To make a new table cell template you can use <source lang="text">{{subst:Table cell templates| text = default text | bg = background color | class = a class name without prefix | align = standard horizontal alignment}}</source> | To make a new table cell template you can use <source lang="text">{{subst:Table cell templates| text = default text | bg = background color | class = a class name without prefix | align = standard horizontal alignment}}</source> | ||
Line 118: | Line 126: | ||
If you find a table cell template that does not take a parameter and you want to be able to change the text in the cell, ''do not'' duplicate the template! Instead, edit the template and change the text to a default parameter substitution. For example, if a template's text is <code>Dropped</code>, change that to <code><nowiki>{{{1|Dropped}}}</nowiki></code>. | If you find a table cell template that does not take a parameter and you want to be able to change the text in the cell, ''do not'' duplicate the template! Instead, edit the template and change the text to a default parameter substitution. For example, if a template's text is <code>Dropped</code>, change that to <code><nowiki>{{{1|Dropped}}}</nowiki></code>. | ||
== See also == | === See also === | ||
* {{tl|multiplayer}} | * {{tl|multiplayer}} | ||
* {{tl|GPL-lic}} | * {{tl|GPL-lic}} | ||
* {{tl|chg}}: calculate and display changes between two values | * {{tl|chg}}: calculate and display changes between two values | ||
== Notes == | === Notes === | ||
{{Reflist}} | {{Reflist}} | ||
Revision as of 10:04, 6 July 2010
This is a documentation subpage for Template:Table cell templates. It may contain usage information, categories and other content that is not part of the original template page. |
The templates in this series are designed to be used in a table to make a cell with text in that cell, with an appropriately coloured background. They are commonly used in comparison tables.
For example, {{yes}}
makes a cell with a green background. The text in the cell is taken from the first parameter; {{yes|Sure}}
would output "Sure" otherwise it defaults to "Yes". Most templates allow authors to override the default text in this way, some require text put after the template call and some also need a vertical bar in between: {{table cell template}} text
or {{table cell template}} | text
. This information, the colors and default texts are found in the table below.
If you want to use other attributes for the table cells, e.g. colspan
or rowspan
, they need to be put before the template call and there must be no vertical bar |
in between them:
Yes | No | N/A |
---|---|---|
Yes/No |
... !{{Yes}} ||{{No}} ||rowspan=2 {{n/a}} |- |colspan=2 {{Yes-No}} ...
Templates in this series
Class[1] | Template | Preview | Preview, alternative |
---|---|---|---|
table-rh |
{{rh}} | Row header | Row header | |
{{rh2}}[2] | Row header | Row header | ||
table-yes |
{{yes}}, {{yes|Alternative [[Plain text|text]]}} | Yes | Alternative text |
table-no |
{{no}}, {{no|Alternative [[Plain text|text]]}} | No | Alternative text |
{{coming soon}} | Coming soon | ||
table-siteactive |
{{siteactive}} | Template:Siteactive | |
table-siteinactive |
{{siteinactive}} | Template:Siteinactive | |
table-yes2 |
{{yes2}}[3] Text | Text | |
{{won}}, {{won|5}} | Won | 5 | |
{{good}}, {{good|A}} | Good | A | |
table-no2 |
{{no2}}[3] Text | Text | |
{{nom}}, {{nom|5}} | Nominated | 5 | |
{{bad}}, {{bad|F}} | Template:Bad | Template:Bad | |
{{sho}} | Shortlisted | ||
table-partial |
{{partial}} | Partial | |
{{yes-No}} | Yes/No | ||
{{okay}}, {{okay|C}} | Neutral | C | |
{{some}} | Some | ||
table-any |
{{any}} | Any | |
table-na |
{{n/a}} | N/A | |
{{BLACK}} | N/A | ||
table-unknown |
{{dunno}} | ? | |
{{unk}} | Template:Unk | ||
table-depends |
{{depends}}, {{depends|Alternative [[Plain text|text]]}} | Depends | Alternative text |
table-included |
{{included}} | Included | |
table-dropped |
{{dropped}} | Dropped | |
{{terminated}} | Terminated | ||
table-beta |
{{beta}} | Beta | |
{{table-experimental}} | Experimental | ||
table-free |
{{free}}, {{free|Alternative [[Plain text|text]]}} | Free | Alternative text |
table-nonfree |
{{nonfree}}, {{nonfree|Alternative [[Plain text|text]]}} | Non-free | Alternative text |
table-proprietary |
{{proprietary}}, {{proprietary|Alternative [[Plain text|text]]}} | Proprietary | Alternate text |
table-needs |
{{needs}}, {{needs|Alternative [[Plain text|text]]}} | Needs | Alternative text |
no class | {{incorrect}}, {{incorrect|Alternative [[Plain text|text]]}} | Incorrect | Alternative text |
no class | {{no result}}, {{no result|N.R.}} | No result | N.R. |
no class | {{pending}} | Pending | |
table-nightly |
{{nightly}}, {{nightly|Alternative [[Plain text|text]]}} | Nightly build | Alternative text |
table-release-candidate |
{{release-candidate}}, {{release-candidate|Alternative [[Plain text|text]]}} | Release candidate | Alternative text |
no class | {{?}}[4] | Template:? | |
no class | {{unofficial}} | Unofficial |
Code
Common code to most if not all the templates in this series:
{{Table cell templates|class=''automatic''|text=''text''|bg=#''abcdef''}}
Code specific to this template:
{{ {{BASEPAGENAME}} }}
To make a new table cell template you can use <source lang="text">{{subst:Table cell templates| text = default text | bg = background color | class = a class name without prefix | align = standard horizontal alignment}}</source>
You should leave out the align
parameter and often the class
parameter is unnecessary, too.
Add the new template to the table in the common documentation afterwards. Please consider reusing one of the other templates and please choose the color sensibly.
If you find a table cell template that does not take a parameter and you want to be able to change the text in the cell, do not duplicate the template! Instead, edit the template and change the text to a default parameter substitution. For example, if a template's text is Dropped
, change that to {{{1|Dropped}}}
.
See also
- {{multiplayer}}
- {{GPL-lic}}
- {{chg}}: calculate and display changes between two values
Notes
- ↑ The HTML class of table cell templates may be referenced in a user stylesheet to change appearance.
- ↑ Does not take a parameter; the content should be placed after the template call, separated by a pipe (|) character.
- ↑ 3.0 3.1 Does not take a parameter; the content should be placed after the template call.
- ↑ Does not take a parameter; not really a table cell template at all, but here for completeness
es:Plantilla:Celda de tabla de plantillas ca:Plantilla:Plantilles per les cel·les de les taules eo:Ŝablono:Jes ne hsb:Předłoha:Haj ně ja:Template:Table cell templates ko:틀:표 셀 틀 sh:Šablon:Da-ne zh:Template:Table cell templates