求真百科歡迎當事人提供第一手真實資料,洗刷冤屈,終結網路霸凌。

變更

前往: 導覽搜尋

Template:Table cell templates/doc

增加 15,136 位元組, 6 年前
無編輯摘要
<noinclude>{{Documentation subpage}}</noinclude>
{{#ifeq:{{FULLPAGENAME}}|Template:BLACK|{{For|the text color template|Template:Black}}}}

本系列的模板是專門為在條目內容中使用[[Help:表格|表格]]而設計,使儲存格內可加入文字,並配以合適的顏色背景。這些模板通常在[[:Category:比較學|比較表格]]中使用。

例如:<code>{{Tl|yes}}</code>這個模版可令一個儲存格變成綠色背景,並寫上“是”這個字。格中的文字来自[[Help:模板#设定参数|第一个参数]];如果改成<code><nowiki>{{</nowiki>yes|當然}}</code>的話,儲存格內原來預設的“是”就會變成“當然”。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:

{| class=wikitable align=right
!{{Yes}} ||{{No}} ||rowspan=2 {{n/a}}
|-
|colspan=2 {{Yes-No}}
|}
<pre>...
!{{Yes}} ||{{No}} ||rowspan=2 {{n/a}}
|-
|colspan=2 {{Yes-No}}
...
</pre>

== 模板列表 ==
<div style="overflow:auto;">
{| class="wikitable" style="text-align: left; width: auto;"
|+ Table cell templates
! 類型<ref name="table-cell-templates-table-css">The HTML class of table cell templates may be referenced in a [[m:help:User style|user stylesheet]] to change appearance.</ref> !! 默认表达式 !! 预览(默认) !! 自定义表达式 !! 预览(自定义)
|-
|rowspan=2| <code>table-rh</code> || {{tl|rh}} {{!}} 栏标题<ref name="table-cell-templates-table-after+pipe" /> || {{rh}} | 栏标题 || {{tlp|rh|2=align=right}} {{!}} 栏标题 || {{rh|align=right}} | 栏标题
|-
| {{tl|rh2}} {{!}} 栏标题<ref name="table-cell-templates-table-after+pipe">Does not take a parameter; the content should be placed after the template call, separated by a pipe (|) character.</ref> || {{rh2}} {{!}} 栏标题 || {{tlp|rh2|2=align=right}} | 栏标题 || {{rh2|align=right}} | 栏标题
|-
| <code>table-yes</code> || {{tl|yes}} || {{yes}} || {{tlp|yes|<nowiki>自定义[[纯文本|文字]]</nowiki>}} ||{{yes|自定义[[纯文本|文字]]}}
|-
| <code>table-maybe</code> || {{tl|maybe}} || {{maybe}} || {{tlp|maybe|<nowiki>自定义[[纯文本|文字]]</nowiki>}} ||{{maybe|自定义[[纯文本|文字]]}}
|-
|rowspan=5| <code>table-no</code> || {{tl|no}} || {{no}} || {{tlp|no|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{no|自定义[[纯文本|文字]]}}
|-
| {{tl|eliminated}} || {{eliminated}} || {{tlp|eliminated|退出}} || {{eliminated|退出}}
|-
| {{tlp|active fire|12%}} || {{active fire|12%}} || ||
|-
| {{tl|lost}} || {{lost}} || {{tlp|lost|Missing}} || {{lost|Missing}}
|-
| {{tl|safe}} || {{safe}} || {{tlp|safe|Protected}} || {{safe|Protected}}
|-
| <code>table-active</code> || {{tl|active}} || {{active}} || {{tlp|active|Lively}} || {{active|Lively}}
|-
|rowspan=2| <code>table-siteactive</code> || {{tl|site active}} || {{site active}} || {{tlp|site active|已上线}} || {{site active|已上线}}
|-
| {{tl|coming soon}} || {{coming soon}} || {{tlp|coming soon|后半年}} || {{coming soon|后半年}}
|-
| <code>table-siteinactive</code> || {{tl|site inactive}} || {{site inactive}} || {{tlp|site inactive|已下线}} || {{site inactive|已下线}}
|-
|rowspan=8| <code>table-yes2</code> || {{tl|good}} || <s><nowiki>{{good}}</nowiki></s> || {{tlp|good|A}} || <s><nowiki>{{good|A}}</nowiki></s>
|-
| {{tl|yes2}} || {{yes2}} || {{tlp|yes2|文字}} || {{yes2|文字}}
|-
| {{tl|ya}} || {{ya}} || {{tlp|ya|text{{=}}Ya}} || {{ya|text=Ya}}
|-
| {{tlp|ya|Ya}} || {{ya|Ya}} || {{tlp|ya|文字|link{{=}}WP:ALT}} || {{ya|文字|link=WP:ALT}}
|-
| {{tl|won}} || {{won}} || {{tlp|won|text{{=}}white|color{{=}}darkblue}} || {{won|text=white|color=darkblue}}
|-
| {{tlp|won|place{{=}}1}} || {{won|place=1}} || {{tlp|won|place{{=}}金牌}} || {{won|place=金牌}}
|-
| {{tlp|won|place{{=}}2}} || {{won|place=2}} || {{tlp|won|place{{=}}银牌}} || {{won|place=银牌}}
|-
| {{tlp|won|place{{=}}3}} || {{won|place=3}} || {{tlp|won|place{{=}}铜牌}} || {{won|place=铜牌}}
|-
|rowspan=7| <code>table-no2</code> || {{tl|no2}} || {{no2}} || {{tlp|no2|文字}} || {{no2|文字}}
|-
| {{tl|na}} || {{na}} || {{tlp|na|text{{=}}Na}} || {{na|text=Na}}
|-
| {{tlp|na|Na}} || {{na|Na}} || {{tlp|na|文字|link{{=}}WP:ALT}} || {{na|文字|link=WP:ALT}}
|-
| {{tl|nom}} || {{nom}} || {{tlp|nom|5}} || {{nom|5}}
|-
| {{tl|sho}} || {{sho}} || {{tlp|sho|Proposed}} || {{sho|Proposed}}
|-
| {{tl|longlisted}} || {{longlisted}} || {{tlp|longlisted|已拒绝}} || {{longlisted|已拒绝}}
|-
| {{tl|TBA}} || {{TBA}} || {{tlp|TBA|即将公布}} || {{TBA|即将公布}}
|-
| rowspan=2 |<code>table-success</code> || {{tl|success}} || {{success}} || {{tlp|success|任务完成}} || {{success|任务完成}}
|-
| {{tl|operational}} || {{operational}} || {{tlp|operational|正传回数据}} || {{operational|正传回数据}}
|-
| <code>table-failure</code> || {{tl|failure}} || {{failure}} || {{tlp|failure|入轨失败}} || {{failure|入轨失败}}
|-
| rowspan=16| <code>table-partial</code> || {{tl|partial}} || {{partial}} || {{tlp|partial|几乎完成}} ||{{partial|几乎完成}}
|-
| {{tl|Regional}} || {{Regional}} || {{tlp|Regional|维吾尔}} || {{Regional|维吾尔}}
|-
| {{tl|MaybeCheck}} || {{MaybeCheck}} || {{tlp|MaybeCheck|text{{=}}有可能}} || {{MaybeCheck|text=有可能}}
|-
| {{tlp|MaybeCheck|有可能}} || {{MaybeCheck|有可能}} || {{tlp|MaybeCheck|文字|link{{=}}WP:ALT}} || {{MaybeCheck|文字|link=WP:ALT}}
|-
| {{tl|partial success}} || {{partial success}} || {{tlp|partial success|<nowiki>入轨成功并传回照片</nowiki>}} || {{partial success|入轨成功并传回照片}}
|-
| {{tl|partial failure}} || {{partial failure}} || {{tlp|partial failure|<nowiki>[[Cubesat]] not deployed</nowiki>}} || {{partial failure|[[Cubesat]] not deployed}}
|-
| {{tl|okay}} || {{okay}} || {{tlp|okay|C}} || {{okay|C}}
|-
| {{tl|Yes-No}} || {{Yes-No}} || {{tlp|Yes-No|Yes with an if; no with a but}} || {{Yes-No|Yes with an if; no with a but}}
|-
| {{tl|some}} || {{some}} || {{tlp|some|Many}} || {{some|Many}}
|-
| {{tl|nonpartisan}} || {{nonpartisan}} || {{tlp|nonpartisan|Impartial}} || {{nonpartisan|Impartial}}
|-
| {{tl|pending}} || {{pending}} || {{tlp|pending|Awaiting}} || {{pending|Awaiting}}
|-
| {{tl|unofficial}} || {{unofficial}} || {{tlp|unofficial|<nowiki>''事实上的''</nowiki>}} || {{unofficial|''事实上的''}}
|-
| {{tl|unofficial2}} || {{unofficial2}} || {{tlp|unofficial2|<nowiki>''事实上的''</nowiki>}} || {{unofficial2|''事实上的''}}
|-
| {{tl|usually}} || {{usually}} || {{tlp|usually|普遍}} || {{usually|普遍}}
|-
| {{tl|rarely}} || {{rarely}} || {{tlp|rarely|罕见}}|| {{rarely|罕见}}
|-
| {{tl|sometimes}} || {{sometimes}} || {{tlp|sometimes|偶尔}} || {{sometimes|偶尔}}
|-
| <code>table-any</code> || {{tl|any}} || {{any}} || {{tlp|any|有人}}|| {{any|有人}}
|-
|rowspan=6| <code>table-na</code> || {{tl|n/a}} || {{n/a}} || {{tlp|n/a|不可用}}|| {{n/a|不可用}}
|-
| {{tl|varies}} || {{varies}} || {{tlp|varies|Differs}}|| {{varies|Differs}}
|-
| {{tl|sdash}} || {{sdash}} || {{tlp|sdash|<nowiki>[[File:Dash.svg|13px|link=|dash icon]]</nowiki>}}|| {{sdash|[[File:Dash.svg|13px|link=|dash]]}}
|-
| {{tl|BLACK}} || {{BLACK}} || {{tlp|BLACK|禁止}} || {{BLACK|禁止}}
|-
| {{tl|non-album single}} || {{non-album single}} || {{tlp|non-album single|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{non-album single|自定义[[纯文本|文字]]}}
|-
| {{tl|unreleased}} || {{unreleased}} || {{tlp|unreleased|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{unreleased|自定义[[纯文本|文字]]}}
|-
|rowspan=2| <code>table-unknown</code> || {{tl|unknown}} || {{Unknown}} || {{tlp|unknown|?}} || {{unknown|?}}
|-
| {{tl|dunno}} || {{Dunno}} || {{tlp|dunno|不确定}} || {{dunno|不确定}}
|-
| <code>table-automatic</code> || {{tl|perhaps}} || {{perhaps}} || {{tlp|perhaps|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{perhaps|自定义[[纯文本|文字]]}}
|-
| <code>table-depends</code> || {{tl|depends}} || {{depends}} || {{tlp|depends|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{depends|自定义[[纯文本|文字]]}}
|-
| <code>table-included</code> || {{tl|included}} || {{included}} || {{tlp|included|Incorporated}} || {{included|Incorporated}}
|-
|rowspan=2| <code>table-dropped</code> || {{tl|dropped}} || {{dropped}} || {{tlp|dropped|已中止}} || {{dropped|已中止}}
|-
| {{tl|terminated}} || {{terminated}} || {{tlp|terminated|被解雇}} || {{terminated|被解雇}}
|-
| <code>table-beta</code> || {{tl|beta}} || {{beta}} || {{tlp|beta|预览}} || {{beta|预览}}
|-
| <code>table-experimental</code> || {{tl|table-experimental}} || {{table-experimental}} || {{tlp|table-experimental|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{table-experimental|自定义[[纯文本|文字]]}}
|-
| <code>table-free</code> || {{tl|free}} || {{free}} || {{tlp|free|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{free|自定义[[纯文本|文字]]}}
|-
| <code>table-proprietary</code> || {{tl|proprietary}} || {{proprietary}} || {{tlp|proprietary|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{proprietary|自定义[[纯文本|文字]]}}
|-
| <code>table-nonfree</code> || {{tl|nonfree}} || {{nonfree}} || {{tlp|nonfree|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{nonfree|自定义[[纯文本|文字]]}}
|-
| <code>table-needs</code> || {{tl|needs}} || {{needs}} || {{tlp|needs|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{needs|自定义[[纯文本|文字]]}}
|-
| <code>table-nightly</code> || {{tl|nightly}} || {{nightly}} || {{tlp|nightly|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{nightly|自定义[[纯文本|文字]]}}
|-
| <code>table-release-candidate</code> || {{tl|release-candidate}} || {{release-candidate}} || {{tlp|release-candidate|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{release-candidate|自定义[[纯文本|文字]]}}
|-
| <code>table-draw</code> || {{tl|draw}} || {{draw}} || {{tlp|draw|文字}} || {{draw|文字}}
|-
| <code>table-planned</code> || {{tl|planned}} || {{planned}} || {{tlp|planned|2018年7月}} || {{planned|2018年7月}}
|-
| <code>table-scheduled</code> || {{tl|scheduled}} || {{scheduled}} || {{tlp|scheduled|2017年3月3日}} || {{scheduled|2017年3月3日}}
|-
| <code>incorrect</code> || {{tl|incorrect}} || {{incorrect}} || {{tlp|incorrect|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{incorrect|自定义[[纯文本|文字]]}}
|-
| <code>noresult</code> || {{tl|no result}} || {{no result}} || {{tlp|no result|N.R.}} || {{no result|N.R.}}
|-
|rowspan=8| ''no class'' || {{tl|CMain}} || {{CMain}} || {{tlp|CMain|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{CMain|自定义[[纯文本|文字]]}}
|-
| {{tl|CAlso starring}} || {{CAlso starring}} || {{tlp|CAlso starring|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{CAlso starring|自定义[[纯文本|文字]]}}
|-
| {{tl|CRecurring}} || {{CRecurring}} || {{tlp|CRecurring|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{CRecurring|自定义[[纯文本|文字]]}}
|-
| {{tl|CGuest}} || {{CGuest}} || {{tlp|CGuest|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{CGuest|自定义[[纯文本|文字]]}}
|-
| {{tl|CNone}} || {{CNone}} || {{tlp|CNone|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{CNone|自定义[[纯文本|文字]]}}
|-
| {{tl|nocontest}} || {{nocontest}} || {{tlp|nocontest|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{nocontest}}自定义[[纯文本|文字]]
|-
| {{tl|not yet}} || <s><nowiki>{{not yet}}</nowiki></s> || {{tlp|not yet|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || <s><nowiki>{{not yet|自定义[[纯文本|文字]]}}</nowiki></s>
|-
| {{tl|optional}} || {{optional}} || {{tlp|optional|<nowiki>自定义[[纯文本|文字]]</nowiki>}} || {{optional|自定义[[纯文本|文字]]}}
|}</div>

== Code ==
Common code to most if not all the templates in this series:
:<code>{{Table cell templates|class=''automatic''|text=''text''|bg=#''abcdef''}}</code>

Code specific to this template:
:<code>{{ {{BASEPAGENAME}} }}</code>

To make a new table cell template you can use:
<syntaxhighlight lang=text enclose="div">{{subst:Table cell templates|text= default text |bg= background color |class= a class name without prefix |align= standard horizontal alignment}}</syntaxhighlight>

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 [[Template: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>.

style="background: #abcdef; color: black; vertical-align: middle; text-align: {{{align|center}}}; {{{style|}}}" class="automatic table-automatic"| {{{1|text}}}

== TemplateData ==
{{TemplateDataHeader}}
<templatedata>{
"description": "使用统一的内容和颜色,各种表格单元格模板之一。",
"params": {
"1": {
"label": "text",
"description": "text to be displayed instead of the default, if this doesn't work put the text after the template, 有可能 with a vertical bar | in between",
"type": "string/line",
"default": "(取决于模板)",
"required": false
},
"align": {
"label": "horizontal align",
"description": "text alignment inside the cell, either 'left', 'right', 'center' or 'justified'",
"default": "center",
"inherits": "1"
},
"style": {
"label": "style",
"description": "a semicolon separated list of additional CSS rules to be applied to the table cell",
"default": "",
"inherits": "1"
},
"color": {
"label": "background color",
"description": "a valid CSS color value or name to override the standard the cell background, only available with some templates",
"inherits": "1"
}
}}</templatedata>

== 参见 ==
* {{tl|change}}: Calculates, displays and color-codes changes between two values
* {{tl|BSD-lic}}: Specialized redirect for {{tlf|free}}
* {{tl|GPL-lic}}: Specialized redirect for {{tlf|free}}
* {{tl|LGPL-lic}}: Specialized redirect for {{tlf|free}}

== 注释 ==
{{reflist}}

<includeonly>{{#switch:{{SUBPAGENAME}}|doc|sandbox=|#default=
<!-- ADD CATEGORIES BELOW THIS LINE -->
[[Category:统一表格单元格模板]]
}}</includeonly>
匿名用戶