模板:Table cell templates/doc

来自戏曲百科

模板:Translating

本系列中的模板用于在表格中创建一个含有文本以及适当的背景颜色的单元格。

它们通常用于比较表中。

例如,{{yes}}将产生一个绿色背景的单元格。单元格中的文本取自第一个参数。例如,{{yes|Sure}}将输出“Sure”;在未指定第一参数值的情况下,{{yes}}将输出默认值:“是”。大多数模板允许编者以这种方式覆盖默认文本,有些模板需要在调用后放置文本({{table cell template}} 文本),有些模板还需要在两者之间使用竖线({{table cell template}} | 文本)。下表中提供了关于颜色和默认文本的信息。

如果您想对表格单元格使用其他属性,例如colspanrowspan,则需要将它们放在被调用的模板之前,并且与被调用的模板之间不能有竖线|,例如:

rowspan=2 模板:N/a
colspan=2 模板:Yes-No
...
!{{Yes}} ||{{No}} ||rowspan=2 {{n/a}}
|-
|colspan=2 {{Yes-No}}
...

模板

Table cell templates
属性[1] 默认语法 预览(默认) 自定义语法 预览(自定义)
table-rh {{rh}} | 行标题[2] 模板:Rh | Row header {{rh|align=right}} | 行标题 模板:Rh | 行标题
{{rh2}} | 行标题[2] 模板:Rh2 | 行标题 {{rh2|align=right}} | 行标题 模板:Rh2 | 行标题
table-yes {{yes}} {{yes|自訂 [[純文字|文字]]}} 自訂 文字
table-maybe {{maybe}} 模板:Maybe {{maybe|自訂 [[純文字|文字]]}} 模板:Maybe
table-no {{no}} {{no|自訂 [[純文字|文字]]}} 自訂 文字
{{eliminated}} 模板:Eliminated {{eliminated|出局}} 模板:Eliminated
{{active fire|12%}} 模板:Active fire
{{lost}} 模板:Lost {{lost|失败}} 模板:Lost
{{safe}} 模板:Safe {{safe|被保护}} 模板:Safe
table-active {{active}} 模板:Active {{active|活跃中}} 模板:Active
table-siteactive {{site active}} 模板:Site active {{site active|Up}} 模板:Site active
{{coming soon}} 模板:Coming soon {{coming soon|半年内}} 模板:Coming soon
table-siteinactive {{site inactive}} 模板:Site inactive {{site inactive|Down}} 模板:Site inactive
table-yes2 {{good}} {{good}} {{good|A}} A}}
{{yes2}} {{yes2|Text}} Text
{{ya}} 模板:Ya {{ya|text=Ya}} 模板:Ya
{{ya|Ya}} 模板:Ya {{ya|text|link=WP:ALT}} 模板:Ya
{{won}} 模板:Won {{won|text=white|color=darkblue}} 模板:Won
{{won|place=1}} 模板:Won {{won|place=Gold}} 模板:Won
{{won|place=2}} 模板:Won {{won|place=Silver}} 模板:Won
{{won|place=3}} 模板:Won {{won|place=Bronze}} 模板:Won
table-no2 {{no2}} 模板:No2 {{no2|Text}} 模板:No2
{{na}} 模板:Na {{na|text=Na}} 模板:Na
{{na|Na}} 模板:Na {{na|text|link=WP:ALT}} 模板:Na
{{nom}} 模板:Nom {{nom|5}} 模板:Nom
{{sho}} 模板:Sho {{sho|Proposed}} 模板:Sho
{{longlisted}} 模板:Longlisted {{longlisted|Rejected}} 模板:Longlisted
{{TBA}} 模板:TBA {{TBA|To be announced}} 模板:TBA
table-success {{success}} 模板:Success {{success|Mission complete}} 模板:Success
{{operational}} 模板:Operational {{operational|Returning data}} 模板:Operational
table-failure {{failure}} 模板:Failure {{failure|Wrong orbit}} 模板:Failure
table-partial {{partial}} 模板:Partial {{partial|Almost done}} 模板:Partial
{{Regional}} 模板:Regional {{Regional|Uyghur}} 模板:Regional
{{MaybeCheck}} 模板:MaybeCheck {{MaybeCheck|text=Possibly}} 模板:MaybeCheck
{{MaybeCheck|Possibly}} 模板:MaybeCheck {{MaybeCheck|text|link=WP:ALT}} 模板:MaybeCheck
{{partial success}} 模板:Partial success {{partial success|Reached orbit and returned pictures}} 模板:Partial success
{{partial failure}} 模板:Partial failure {{partial failure|[[Cubesat]] not deployed}} 模板:Partial failure
{{okay}} 模板:Okay {{okay|C}} 模板:Okay
{{Yes-No}} 模板:Yes-No {{Yes-No|Yes with an if; no with a but}} 模板:Yes-No
{{some}} 模板:Some {{some|Many}} 模板:Some
{{nonpartisan}} 模板:Nonpartisan {{nonpartisan|Impartial}} 模板:Nonpartisan
{{pending}} 模板:Pending {{pending|Awaiting}} 模板:Pending
{{unofficial}} 模板:Unofficial {{unofficial|''De facto''}} 模板:Unofficial
{{unofficial2}} 模板:Unofficial2 {{unofficial2|''De facto''}} 模板:Unofficial2
{{usually}} 模板:Usually {{usually|Commonly}} 模板:Usually
{{rarely}} 模板:Rarely {{rarely|Seldom}} 模板:Rarely
{{sometimes}} 模板:Sometimes {{sometimes|Occasionally}} 模板:Sometimes
table-any {{any}} 模板:Any {{any|Anyone}} 模板:Any
table-na {{n/a}} 模板:N/a {{n/a|Unavailable}} 模板:N/a
{{varies}} 模板:Varies {{varies|Differs}} 模板:Varies
{{sdash}} 模板:Sdash {{sdash|[[File:Dash.svg|13px|link=|dash icon]]}} 模板:Sdash
{{BLACK}} 模板:BLACK {{BLACK|Banned}} 模板:BLACK
{{non-album single}} 模板:Non-album single {{non-album single|自訂 [[純文字|文字]]}} 模板:Non-album single
{{unreleased}} 模板:Unreleased {{unreleased|自訂 [[純文字|文字]]}} 模板:Unreleased
table-unknown {{unknown}} 模板:Unknown {{unknown|?}} 模板:Unknown
{{dunno}} 模板:Dunno {{dunno|Not sure}} 模板:Dunno
table-automatic {{perhaps}} 模板:Perhaps {{perhaps|自訂 [[純文字|文字]]}} 模板:Perhaps
table-depends {{depends}} 模板:Depends {{depends|自訂 [[純文字|文字]]}} 模板:Depends
table-included {{included}} 模板:Included {{included|Incorporated}} 模板:Included
table-dropped {{dropped}} 模板:Dropped {{dropped|Discontinued}} 模板:Dropped
{{terminated}} 模板:Terminated {{terminated|Fired}} 模板:Terminated
table-beta {{beta}} 模板:Beta {{beta|Preview}} 模板:Beta
table-experimental {{table-experimental}} 模板:Table-experimental {{table-experimental|自訂 [[純文字|文字]]}} 模板:Table-experimental
table-free {{free}} 模板:Free {{free|自訂 [[純文字|文字]]}} 模板:Free
table-proprietary {{proprietary}} 模板:Proprietary {{proprietary|自訂 [[純文字|文字]]}} 模板:Proprietary
table-nonfree {{nonfree}} 模板:Nonfree {{nonfree|自訂 [[純文字|文字]]}} 模板:Nonfree
table-needs {{needs}} 模板:Needs {{needs|自訂 [[純文字|文字]]}} 模板:Needs
table-nightly {{nightly}} 模板:Nightly {{nightly|自訂 [[純文字|文字]]}} 模板:Nightly
table-release-candidate {{release-candidate}} 模板:Release-candidate {{release-candidate|自訂 [[純文字|文字]]}} 模板:Release-candidate
table-draw {{draw}} 模板:Draw {{draw|Text}} 模板:Draw
table-planned {{planned}} 模板:Planned {{planned|July 2018}} 模板:Planned
table-scheduled {{scheduled}} 模板:Scheduled {{scheduled|3 March 2017}} 模板:Scheduled
incorrect {{incorrect}} 模板:Incorrect {{incorrect|自訂 [[純文字|文字]]}} 模板:Incorrect
noresult {{no result}} 模板:No result {{no result|N.R.}} 模板:No result
no class {{CMain}} 模板:CMain {{CMain|自訂 [[純文字|文字]]}} 模板:CMain
{{CAlso starring}} 模板:CAlso starring {{CAlso starring|自訂 [[純文字|文字]]}} 模板:CAlso starring
{{CRecurring}} 模板:CRecurring {{CRecurring|自訂 [[純文字|文字]]}} 模板:CRecurring
{{CGuest}} 模板:CGuest {{CGuest|自訂 [[純文字|文字]]}} 模板:CGuest
{{CNone}} 模板:CNone {{CNone|自訂 [[純文字|文字]]}} 模板:CNone
{{nocontest}} 模板:Nocontest {{nocontest|自訂 [[純文字|文字]]}} 模板:Nocontest自訂 文字
{{not yet}} 模板:Not yet {{not yet|自訂 [[純文字|文字]]}} 模板:Not yet
{{optional}} 模板:Optional {{optional|自訂 [[純文字|文字]]}} 模板:Optional

Code

Common code to most if not all the templates in this series:

模板:Table cell templates

Code specific to this template:

模板:Table cell templates

To make a new table cell template you can use: {{subst:Table cell templates|text= default text |bg= background color |class= a class name without prefix |align= standard horizontal alignment}}

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}}}.

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

TemplateData

这是用于新版可视化编辑器及其他工具的模板数据文档。

Table cell templates模板数据

One of several templates for styling individual table cells with standard contents and colors.

模板参数

参数描述类型状态
text1

text to be displayed instead of the default, if this doesn't work put the text after the template, possibly with a vertical bar | in between

默认值
(template dependent)
单行文本可选
horizontal alignalign

text alignment inside the cell, either 'left', 'right', 'center' or 'justified'

默认值
center
单行文本可选
stylestyle

a semicolon separated list of additional CSS rules to be applied to the table cell

默认值
单行文本可选
background colorcolor

a valid CSS color value or name to override the standard the cell background, only available with some templates

默认值
(template dependent)
单行文本可选

See also

  • {{Change}} – calculates, displays and color-codes changes between two values
  • {{BSD-lic}} – specialized redirect for {{free}}
  • {{GPL-lic}} – specialized redirect for {{free}}
  • {{LGPL-lic}} – specialized redirect for {{free}}

Notes

模板:Reflist


  1. 可以在用户样式表中引用表格单元格模板的HTML属性以更改外观。
  2. 2.0 2.1 不带参数; 内容应放置在被调用的模板之后,并以竖线(|)字符分隔。