Jump to content

Template:Shading PVI/doc

From Wikipedia, the free encyclopedia

This template automatically shades the table cell containing PVI data with the default party shading colors, autocalculates sort values for the given PVI value, and shows it in the form X+n format, where X is the party, and n is the degree of lean.

For autocalculating the PVI value, and showing it in the form X+n format, without shading the table cell, use Template:PVI instead.

Usage

[edit]

Copy and paste the template below:

{{Shading PVI|<!-- Party name -->|<!-- Value -->}}
NOTE:Additional table formatting such as rowspan= should be written just before this template, without any bar "|" (see #Using rowspan= subsection below). The style= tags however do not work (see #Unacceptable syntax subsection below).

For better understanding see Examples & TemplateData below.

Examples

[edit]
Sample code Result
Acceptable syntax
{| class="wikitable sortable"
! District
! PVI
|-
| [[Virginia's 16th congressional district]]
| {{Shading PVI|R|6}}
|-
| [[Virginia's 17th congressional district]]
| {{Shading PVI|D|2}}
|-
| [[Virginia's 18th congressional district]]
| {{Shading PVI|Even}}
|-
| [[Virginia's 19th congressional district]]
| {{Shading PVI|party=R|value=20}}
|-
| [[Virginia's 20th congressional district]]
| {{Shading PVI|value=12|party=D}}
|-
| [[Virginia's 21st congressional district]]
| {{Shading PVI|1=D|2=13}}
|-
| [[Virginia's 22nd congressional district]]
| {{Shading PVI|Even|0}}
|}
District PVI
Virginia's 16th congressional district R+6
Virginia's 17th congressional district D+2
Virginia's 18th congressional district Even
Virginia's 19th congressional district R+20
Virginia's 20th congressional district D+12
Virginia's 21st congressional district D+13
Virginia's 22nd congressional district Even
Unacceptable syntax
{| class="wikitable sortable"
! District
! PVI
|-
| [[New York's 31st congressional district]]
| {{Shading PVI|Republican|5}}
|-
| [[New York's 32nd congressional district]]
| {{Shading PVI|2|D}}
|-
| [[New York's 33rd congressional district]]
| {{Shading PVI|d|2}}
|-
| [[New York's 34th congressional district]]
| {{Shading PVI|even}}
|-
| [[New York's 35th congressional district]]
| {{Shading PVI|R|+7}}
|-
| [[New York's 36th congressional district]]
| style="color:green;" | {{Shading PVI|Even}}
|-
| [[New York's 37th congressional district]]
| style="color:green;" {{Shading PVI|Even}}
|-
| [[New York's 38th congressional district]]
| rowspan="2" | {{Shading PVI|R|2}}
|-
| [[New York's 39th congressional district]]
|}
District PVI
New York's 31st congressional district Republican+5
New York's 32nd congressional district 2+D
New York's 33rd congressional district d+2
New York's 34th congressional district even+
New York's 35th congressional district R++7
New York's 36th congressional district style="background:#EEEEEE" | Even
New York's 37th congressional district Even
New York's 38th congressional district style="background-color:#FFB6B6" | R+2
New York's 39th congressional district
Using rowspan=
(see New York's 38th congressional district example above
to know what happens if a unwanted bar is used after rowspan tag.)
{| class="wikitable sortable"
! District
! PVI
! Incumbent
|-
| rowspan="2" | [[Vermont's 1st congressional district]]
| rowspan="2" {{Shading PVI|R|8}}
| [[Abraham Lincoln]]
|-
| [[Andrew Johnson]]
|-
| [[Vermont's 2nd congressional district]]
| rowspan="2" {{Shading PVI|Even}}
| [[Franklin D. Roosevelt]]
|-
| [[Vermont's 3rd congressional district]]
| [[Theodore Roosevelt]]
|}
District PVI Incumbent
Vermont's 1st congressional district R+8 Abraham Lincoln
Andrew Johnson
Vermont's 2nd congressional district Even Franklin D. Roosevelt
Vermont's 3rd congressional district Theodore Roosevelt

TemplateData

[edit]

No description.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Partyparty 1

Party name: Use D for Democratic-leaning, R for Republican-leaning & Even for Even districts.

Suggested values
D R Even
Stringrequired
Valuevalue 2

Denotes the degree of Democratic/ Republican lean. Do not use any symbols before or after the number. Not required to specify for Even districts.

Numberrequired