Module:Convert/documentation/conversion data
This page contains the master list for nearly all conversion data required by Module:Convert (under development here; see the Scribunto overview).
The wikitext of this page is read by a script (available here). The script ignores everything except for what is in the == Specification ==
section. In that section, a level-3 heading (like === Length ===
) starts a table that defines units of a certain type. In that subsection, lines that start with |
are processed (all other lines, and lines that start with |-
or |}
, are ignored). A processed line is split into fields (delimited with ||
), and leading/trailing whitespace is removed from each field. Empty fields are given a default value (for example, the plural of yard is formed by adding s, and the US names are also yard and yards).
Some unit codes are an alias for another spelling of the unit code. For example, the code foot
is an alias for ft
, and that is indicated by entering =ft
in the Symbol column for the foot
entry. There should be no other entries on an alias line, except that sp=us
may be entered in the US symbol column—that entry means that using the alias forces US spelling. An alias can only be entered after the primary unit has been defined (the ft
entry must precede the foot
entry).
The script outputs the Lua source that defines the units table (with no empty fields), and that source can be manually copied into Module:Convert.
Specification
The following data matches what was in Module:Convert at 15 September 2012. I am working on a large file with data for nearly all units documented as working with {{Convert}} (the power section and a couple of others are not well documented, and will have to be done later). I will update the following in the next few days.
Area
Unit code | Symbol | US symbol | Scale | Offset | Name | Plural name | US name | US plural name | Prefix | Default |
---|---|---|---|---|---|---|---|---|---|---|
m2 | m2 | 1 | square metre | square meter | sqyd | |||||
a | a | 100 | are | SI | acre | |||||
sqft | sq ft | 0.09290304 | square foot | square feet | m2 | |||||
sqyd | sq yd | 0.83612736 | square yard | m2 | ||||||
acre | acre | 4046.8564224 | acre | ha |
Length
Unit code | Symbol | US symbol | Scale | Offset | Name | Plural name | US name | US plural name | Prefix | Default |
---|---|---|---|---|---|---|---|---|---|---|
m | m | 1 | metre | meter | SI | ft | ||||
mi | mi | 1609.344 | mile | km | ||||||
ft | ft | 0.3048 | foot | feet | m | |||||
foot | =ft | |||||||||
yd | yd | 0.3048 * 3 | yard | m | ||||||
in | in | 0.0254 | inch | inches | cm |
Mass
Unit code | Symbol | US symbol | Scale | Offset | Name | Plural name | US name | US plural name | Prefix | Default |
---|---|---|---|---|---|---|---|---|---|---|
g | g | 0.001 | gram | SI | oz | |||||
lb | lb | 0.45359237 | pound | kg | ||||||
oz | oz | 0.45359237/16 | ounce | g | ||||||
ozt | ozt | 0.0311034768 | troy ounce | g |
Temperature
Unit code | Symbol | US symbol | Scale | Offset | Name | Plural name | US name | US plural name | Prefix | Default |
---|---|---|---|---|---|---|---|---|---|---|
K | K | 1 | kelvin | C | ||||||
C | °C | 1 | -273.15 | degree Celsius | degrees Celsius | F | ||||
°C | =C | |||||||||
F | °F | 5/9 | 32-273.15*(9/5) | degree Fahrenheit | degrees Fahrenheit | C | ||||
°F | =F |
Volume
Unit code | Symbol | US symbol | Scale | Offset | Name | Plural name | US name | US plural name | Prefix | Default |
---|---|---|---|---|---|---|---|---|---|---|
m3 | m3 | 1 | cubic metre | cubic meter | cuyd | |||||
l | l | 0.001 | litre | liter | SI | imppt | ||||
L | L | 0.001 | litre | liter | SI | imppt | ||||
cuyd | cu yd | 0.764554857984 | cubic yard | m3 | ||||||
USgal | US gal | U.S. gal | 0.003785411784 | US gallon | U.S. gallon | L | ||||
USoz | US fl oz | U.S. fl oz | 0.003785411784/128 | US fluid ounce | U.S. fluid ounce | cL | ||||
USpt | US pt | 0.003785411784/8 | U.S. pint | dL | ||||||
impgal | imp gal | 0.00454609 | imperial gallon | L | ||||||
impoz | imp fl oz | 0.00454609/160 | imperial fluid ounce | cL | ||||||
imppt | imp pt | 0.00454609/8 | imperial pint | dL |