Jump to content

User:Wikid77/Template:Convert/per/doc

From Wikipedia, the free encyclopedia

The Template:Convert/per is a variation of Template:Convert to handle per-unit conversions, such as counted items per metre.

Usage

[edit]

The 1st parameter is the amount, but 2nd is the count-unit, followed by 3rd parameter as the base per-unit.

{{convert/per |45|people|sqmi|km2}} → 45 people per square mile (17 people/km2)

The output count-unit defaults to the same (parameter 2), else use "out=" to reword the count-unit, such as singular/plural or abbreviated. Examples:

  • {{convert/per |1|dog|sqmi|km2|out=dogs}} → 1 dog per square mile (0.39 dogs/km2)
  • {{convert/per |1|person|sqmi|km2|out=ppl}} → 1 person per square mile (0.39 ppl/km2)

In most cases, the count-unit will use the same word for both input and output, as defaulted.

Examples

[edit]

Many options are allowed:

  • {{convert/per |27|deer|sqmi|km2|abbr=~}} → 27 deer/square mile (sq mi, 10 deer/km2)
  • {{convert/per |6|added|kg|lb|lk=out}} → 6 added per kilogram (2.7 added/lb)
  • ${{convert/per |8||lb|kg|disp=x| [$|]}} → $8 per pound [$18* /kg]

See also

[edit]
  • {{convert/f}}    – convert an amount with special formatting
  • {{convert/2}}    – convert a set of 2 amounts, with any words between
  • {{convert/3}}    – convert a set of 3 amounts, with any words between
  • {{convert/4}}    – convert a set of 4 amounts, with any words between
  • {{convert/flip2}}    – convert 2 amounts flipped, with any words between
  • {{convert/flip3}}    – convert 3 amounts flipped, with any words between
  • {{convert/flip4}}    – convert 4 amounts flipped, with any words between
  • {{convert/show2}} – convert 2 amounts, with free-form text
  • {{convert/show3}} – convert 3 amounts, with free-form text