Templat:Table cell templates/doc: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
RyanJulian21 (bicara | kontrib)
 
(5 revisi perantara oleh 4 pengguna tidak ditampilkan)
Baris 1:
<noinclude>{{Documentation subpage}}</noinclude>
 
The templates in this series are designed to be used in a [[HelpBantuan:Table|table]] to make a cell with text in that cell, with an appropriately colored 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 [[HelpBantuan: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:
Baris 34:
|rowspan=5| <code>table-no</code> || {{Tl|no}} || {{no}} || {{Tlp|no|<nowiki>Customized [[Plain text|text]]</nowiki>}} || {{no|Customized [[Plain text|text]]}}
|-
| {{tl|na}} || {{NaYa}} || {{tlp|na|Customized alt text|link{{=}}WP:ALT}} || {{Na|Customized alt text|link=WP:ALT}}
|-
| {{Tl|coming soon}} || {{coming soon}} || ||
Baris 147:
 
To make a new table cell template you can use:
<sourcesyntaxhighlight lang=text>{{subst:Table cell templates| text = default text | bg = background color | class = a class name without prefix | align = standard horizontal alignment}}</sourcesyntaxhighlight>
 
You should leave out the <code>align</code> parameter and often the <code>class</code> parameter is unnecessary, too.
 
Add the new template to the table in the [[TemplateTemplat:Table cell templates/doc|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 <code>Dropped</code>, change that to <code><nowiki>{{{1|Dropped}}}</nowiki></code>.
Baris 166:
 
<!-- ADD CATEGORIES BELOW THIS LINE -->
[[CategoryKategori:Table cell templates]]
<noinclude>
<!-- ADD INTERWIKIS BELOW THIS LINE -->
[[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:틀:표 셀 틀]]
[[ru:Шаблон:Победа]]
[[sh:Šablon:Da-ne]]
[[zh:Template:Table cell templates]]
</noinclude>