قالب:United States presidential election results table row

Template documentation[view] [edit] [history] [purge]

Usage

This is used to form the rows of United States Presidential election tables, alongside Template:PresHead and Template:PresFoot. It automatically calculates the percentages won from each party based on the data entered, and automatically bolds the party winner. It may also be placed at the bottom of the table in place of PresFoot, which is identical to this template (and indeed a transclusion of it) with the ending cap of a WikiTable attached to it. The testcase page for all three templates is that of this one, and can be found here.

None of the parameters are named, and must be entered in order as follows:
{{PresRow| Year of election (by default 2016)| Party winner | Vote towards Republican/Whig candidate | Vote towards Democratic candidate | Vote towards third-party candidates}}

Important information on whitespace:
The party winner field should note the party exactly as its name is written in the "Template:Party shading/" subpage, without any whitespace between it and the pipe. For example, a GOP win should be written exactly, without quotes, as "|Republican" and a Democratic one "|Democratic" (NOTE the "-ic" at the end). In addition, please do not put any whitespace after the vote values, though this is for aesthetic reasons rather than coding. Whitespace shouldn't matter anywhere else.

Aliases:

Substitution:

PresHead and PresFoot should NOT be substituted. The code works just the same if they are, but it is not best practice to substitute them. PresHead should not be substituted because it doesn't speed up the performance of the page appreciably and leaves it unable to automatically conform to any changes to the template (however low a chance they may have of happening). PresFoot should not be substituted because it won't necessarily be the earliest Presidential election available (earlier data may yet be found, for example), and it leaves a "cap" to the wikitable that proves a slight inconvenience to remove.

PresRow (this particular template) may be substituted at the discretion of the editor to help avoid the transclusor (i.e., the page on which the template is transcluded) reaching the template limits. Either {{subst:}} or {{safesubst:}} work.