Difference between revisions of "Template:Election box US auto/doc"

From blackwiki
Jump to navigation Jump to search
imported>Legoktm
(+{{lua}})
imported>Legoktm
(document primary=yes)
Line 55: Line 55:
 
"example": "Democratic",
 
"example": "Democratic",
 
"type": "string"
 
"type": "string"
 +
},
 +
"primary": {
 +
"label": "Primary",
 +
"description": "Whether to include primary information in the same template",
 +
"example": "yes",
 +
"type": "string",
 +
"default": "no"
 
}
 
}
 
},
 
},

Revision as of 08:03, 12 November 2018

Usage

Example: {{election box US auto|California|2016|United States Representative District 7}}


United States House of Representatives elections, 2016[1]
Party Candidate Votes %
style="background-color: Template:Political party color; width: 5px;" | Democratic Ami Bera (Incumbent) 152,133 51.2%
style="background-color: Template:Republican Party (US)/meta/color; width: 2px;" | [[Republican Party (US)|Template:Republican Party (US)/meta/shortname]] Scott R. Jones 145,168 48.8%
Total votes 297,301 100.0%
style="background-color: Template:Political party color" | Democratic hold


A {{election box}} template for US elections that automatically builds the table using tabular data from Commons.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
State1

no description

Example
California
Stringrequired
Year2

Year the election took place

Example
2016
Numberrequired
Contest3

Name of the contest as specified in the tabular data

Example
United States Representative District 8
Stringrequired
Typetype

Type of election, can be "Primary"

Default
"General"
Stringoptional
Holdhold

"held" if the same party held the seat, or "flip" if Democrats/Republicans switched.

Example
held
Unknownoptional
Gain partygain

Name of party which gains the seat

Example
Democratic
Stringoptional
Loser partyloser

Name of party that lost the seat

Example
Democratic
Stringoptional
Primaryprimary

Whether to include primary information in the same template

Default
no
Example
yes
Stringoptional