Template:Convert

From Ace Combat Wiki
Jump to navigation Jump to search
Template documentation (for the template shown above, sometimes hidden or invisible)

This template calculates from one measurement unit to another and presents the results with proper formatting. It invokes Module:Convert, adapted from Wikipedia's module.

Examples

By default, the input unit is spelled out and the output unit is abbreviated.

{{convert|2|km|mi}} 2 kilometres (1.2 mi) (km entered, converted into mi)
{{convert|7|mi|km}} 7 miles (11 km) (mi entered, converted into km)

The parameter abbr=in abbreviates the input unit and spells out the output unit. abbr=on abbreviates both units, and abbr=off spells out both units.

{{convert|2|km|mi|abbr=in}} 2 km (1.2 miles)
{{convert|2|km|mi|abbr=on}} 2 km (1.2 mi)
{{convert|2|km|mi|abbr=off}} 2 kilometres (1.2 miles)

Outputs can be rounded to a certain number of decimal points or significant figures.

{{convert|2|km|mi|2}} 2 kilometres (1.24 mi)
{{convert|2|km|mi|sigfig=3}} 2 kilometres (1.24 mi)
{{convert|118|km|mi|2}} 118 kilometres (73.32 mi)
{{convert|118|km|mi|sigfig=3}} 118 kilometres (73.3 mi)

Using |to/and/-| provides a value range. The latter option uses a hyphen (-) in the template code and automatically prints endashes (–).

{{convert|2|to|5|km|mi}} 2 to 5 kilometres (1.2 to 3.1 mi)
{{convert|2|and|5|km|mi}} 2 and 5 kilometres (1.2 and 3.1 mi)
{{convert|2|-|5|km|mi}} 2–5 kilometres (1.2–3.1 mi)

This example combines all of the above options and includes decimals provided by the user in the input:

{{convert|2.00|-|5.00|km|mi|sigfig=3|abbr=on}} 2.00–5.00 km (1.24–3.11 mi)

Further reading

For more information on this module and other usage examples, see Template:Convert and Help:Convert on Wikipedia.