Permanently protected template

Template:D-Nv

From Historical Hastings
NV
Template documentation[view] [edit] [history] [purge]

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 colored 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[edit]

Table cell templates
Class[1] Default syntax Preview (default) Customized syntax Preview (customized)
table-rh {{rh}} | Row header[2] Row header {{rh|align=right}} | Row header Row header
{{rh2}} | Row header[2] Row header {{rh2|align=right}} | Row header Row header
table-yes {{yes}} Yes {{yes|Customized Plain text}} Customized Plain text
{{yes C}} Green check.svg Yes {{yes C|Customized Plain text}} Green check.svg Customized Plain text
{{yes O}} Symbol confirmed.svg Yes {{yes O|Customized Plain text}} Symbol confirmed.svg Customized Plain text
table-maybe {{maybe}} Maybe {{maybe|Customized Plain text}} Customized Plain text
table-no {{no}} No {{no|Customized Plain text}} Customized Plain text
{{no O}} Pictogram voting delete.svg No {{no O|Customized Plain text}} Pictogram voting delete.svg Customized Plain text
{{no X}} Dark Red x.svg No {{no X|Customized Plain text}} Dark Red x.svg Customized Plain text
{{eliminated}} Eliminated {{eliminated|Dropped out}} Dropped out
{{active fire|12%}} Active (12%)
{{lost}} Lost {{lost|Missing}} Missing
{{safe}} Safe {{safe|Protected}} Protected
table-active {{active}} Active {{active|Lively}} Lively
table-siteactive {{site active}} Active {{site active|Up}} Up
{{coming soon}} Coming soon {{coming soon|Second half of the year}} Second half of the year
table-siteinactive {{site inactive}} Inactive {{site inactive|Down}} Down
table-yes2 {{good}} Good {{good|A}} A
{{yes2}} {{yes2|Text}} Text
{{ya}} Yes {{ya|text=Ya}} Ya
{{ya|Ya}} Ya {{ya|text|link=WP:ALT}} text
{{won}} Won {{won|text=white|color=darkblue}} Won
{{won|place=1}} 1 {{won|place=Gold}} Gold
{{won|place=2}} 2 {{won|place=Silver}} Silver
{{won|place=3}} 3 {{won|place=Bronze}} Bronze
{{WinDL}} W {{WinDL|Win}} Win
{{WinDL|res=D}} D {{WinDL|res=Draw}} Draw
{{WinDL|res=L}} L {{WinDL|res=Loss}} Loss
table-no2 {{no2}} {{no2|Text}} Text
{{na}} No {{na|text=Na}} Na
{{na|Na}} Na {{na|text|link=WP:ALT}} text
{{nom}} Nominated {{nom|5}} 5
{{sho}} Shortlisted {{sho|Proposed}} Proposed
{{longlisted}} Longlisted {{longlisted|Rejected}} Rejected
{{TBA}} TBA {{TBA|To be announced}} To be announced
{{BLACK}} N/A {{BLACK|Banned}} Banned
table-unknown {{unknown}} Unknown {{unknown|?}} ?
{{dunno}} ? {{dunno|Not sure}} Not sure
table-automatic {{perhaps}} Perhaps {{perhaps|Customized Plain text}} Customized Plain text
table-depends {{depends}} Depends {{depends|Customized Plain text}} Customized Plain text
table-included {{included}} Included {{included|Incorporated}} Incorporated
table-dropped {{dropped}} Dropped {{dropped|Discontinued}} Discontinued
{{terminated}} Terminated {{terminated|Fired}} Fired
table-debate {{D-P}} P {{D-P|Present}} Present
{{D-A}} A {{D-A|Absent}} Absent
{{D-I}} I {{D-I|Invited}} Invited
{{D-O}} O {{D-O|Invited to other debate}} Invited to other debate
{{D-N}} N {{D-N|Not invited}} Not invited
{{D-Nv}} NV {{D-Nv|Not Voting}} Not Voting
{{D-W}} W {{D-W|Withdrawn}} Withdrawn
{{D-Out}} Out {{D-Out|Out of race}} Out of race

Code[edit]

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

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

Code specific to this template:

style="background: #FFD; color: #000; vertical-align: middle; text-align: center; " class="table-debate"|NV

To make a new table cell template you can use:

{{#if:|data-sort-value="<nowiki>{{{sort|</nowiki>{{{sort}}}<nowiki>}}}</nowiki>"}} style="background: background color; color: black; vertical-align: middle; text-align: <nowiki>{{{align|</nowiki>standard horizontal alignment<nowiki>}}}</nowiki>; <nowiki>{{{style|}}}</nowiki>" class="a class name without prefix table-a class name without prefix"| <nowiki>{{{1|</nowiki>default text<nowiki>}}}</nowiki>

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[edit]

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the [https://bambots.brucemyers.com/TemplateParam.php?wiki=enwiki&template=D-Nv monthly error reporHatnotefor this template.

TemplateData for D-Nv

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

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
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

Default
(template dependent)
Contentoptional
horizontal alignalign

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

Default
center
Stringoptional
stylestyle

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

Default
(template dependent)
Stringoptional
background colorcolor

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

Default
(template dependent)
Lineoptional

See also[edit]

  • {{Change}} – calculates, displays and color-codes changes between two values

Notes[edit]

  1. ↑ The HTML class of table cell templates may be referenced in a user stylesheet to change appearance.
  2. ↑ a b Does not take a parameter; the content should be placed after the template call, separated by a pipe (|) character.