Template talk:Convert/unit sandbox

To see the current results, it may be necessary to purge this page.

Information from the following may be copied, then pasted into Module:Convert/extra to define a new unit.

  • Any units already in Module:Convert/extra should not be removed—add new units by inserting them after the last "},".
  • Convert uses Module:Convert/data to look up a unit, and only uses Module:Convert/extra if the unit is not found in the main data. That means the "extra" module can only define new units—units defined in the "data" module cannot be modified in the "extra" module (if needed, ask at Template talk:Convert).
-- Conversion data used by [[Module:Convert]] which uses mw.loadData() for
-- read-only access to this module so that it is loaded only once per page.
-- See [[:en:Template:Convert/Transwiki guide]] if copying to another wiki.
--
-- These data tables follow:
--   all_units           all properties for a unit, including default output
--   default_exceptions  exceptions for default output ('kg' and 'g' have different defaults)
--   link_exceptions     exceptions for links ('kg' and 'g' have different links)
--
-- These tables are generated by a script which reads the wikitext of a page that
-- documents the required properties of each unit; see [[:en:Module:Convert/doc]].

---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above).   --
---------------------------------------------------------------------------
local all_units = {
    ["isp"] = {
	name1    = "second",
	symbol   = "s",
	utype    = "speed",
	scale    = 9.80665,
	default  = "km/s",
	link     = "Specific impulse",
    },
    ["km/h"] = {
	name1    = "kilometre per hour",
	name1_us = "kilometer per hour",
	name2    = "kilometres per hour",
	name2_us = "kilometers per hour",
	symbol   = "km/h",
	utype    = "speed",
	scale    = 0.27777777777777779,
	default  = "mph",
	link     = "Kilometres per hour",
    },
    ["km/s"] = {
	name1    = "kilometre per second",
	name1_us = "kilometer per second",
	name2    = "kilometres per second",
	name2_us = "kilometers per second",
	symbol   = "km/s",
	utype    = "speed",
	scale    = 1000,
	default  = "mi/s",
	link     = "Metre per second",
    },
    ["kNs/kg"] = {
	name2    = "kN-s/kg",
	symbol   = "kN-s/kg",
	utype    = "speed",
	scale    = 1000,
	default  = "isp",
	link     = "Specific impulse",
    },
    ["mi/s"] = {
	name1    = "mile per second",
	name2    = "miles per second",
	symbol   = "mi/s",
	utype    = "speed",
	scale    = 1609.344,
	default  = "km/s",
	link     = "Mile",
    },
    ["mph"] = {
	name1    = "mile per hour",
	name2    = "miles per hour",
	symbol   = "mph",
	utype    = "speed",
	scale    = 0.44704,
	default  = "km/h",
	link     = "Miles per hour",
    },
    ["Ns/kg"] = {
	name2    = "N-s/kg",
	symbol   = "N-s/kg",
	utype    = "speed",
	scale    = 1,
	default  = "isp",
	link     = "Specific impulse",
    },
    ["si tsfc"] = {
	name2    = "g/(kN·s)",
	symbol   = "g/(kN·s)",
	utype    = "speed",
	scale    = 9.9999628621379242e-7,
	invert   = -1,
	iscomplex= true,
	default  = "tsfc",
	link     = "Thrust specific fuel consumption",
    },
    ["tsfc"] = {
	name2    = "lb/(lbf·h)",
	symbol   = "lb/(lbf·h)",
	utype    = "speed",
	scale    = 2.832545036049801e-5,
	invert   = -1,
	iscomplex= true,
	default  = "si tsfc",
	link     = "Thrust specific fuel consumption",
    },
    ["kWh/100mi"] = {
	name1    = "kilowatt-hour per 100 miles",
	name2    = "kilowatt-hours per 100 miles",
	symbol   = "kW-hrs/100 mi",
	utype    = "speed",
	scale    = 22.3694,
	default  = "mpge",
	link     = "miles per gallon gasoline equivalent",
    },
    ["kWh/100km"] = {
	name1    = "kilowatt-hour per 100 kilometres",
	name1_us = "kilowatt-hour per 100 kilometers",
	name2    = "kilowatt-hours per 100 kilometres",
	name2_us = "kilowatt-hours per 100 kilometers",
	symbol   = "kWh/100 km",
	utype    = "speed",
	scale    = 36,
	default  = "mpge",
	link     = "miles per gallon gasoline equivalent",
    },
    ["mpge"] = {
	name1    = "mile per gallon gasoline equivalent",
	name2    = "miles per gallon gasoline equivalent",
	symbol   = "mpg-e",
	utype    = "speed",
	scale    = 13.00e-6,
	invert   = -1,
	iscomplex= true,
	default  = "kWh/100mi",
	link     = "miles per gallon gasoline equivalent",
    },
    ["mpg-e"] = {
	target   = "mpge",
    },
    ["bit"] = {
	_name1   = "bit",
	_symbol  = "bit",
	utype    = "information",
	scale    = 0.125,
	prefixes = 1,
	default  = "B",
	link     = "Bit",
    },
    ["B"] = {
	_name1   = "byte",
	_symbol  = "B",
	utype    = "information",
	scale    = 8,
	prefixes = 1,
	default  = "bit",
	link     = "Byte",
    },
}

---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above).   --
---------------------------------------------------------------------------
local default_exceptions = {
	-- Prefixed units with a default different from that of the base unit.
	-- Each key item is a prefixed symbol (unitcode for engineering notation).
}

---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above).   --
---------------------------------------------------------------------------
local link_exceptions = {
	-- Prefixed units with a linked article different from that of the base unit.
	-- Each key item is a prefixed symbol (not unitcode).
}

---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above).   --
---------------------------------------------------------------------------
local per_unit_fixups = {
	-- Automatically created per units of form "x/y" may have their unit type
	-- changed, for example, "length/time" is changed to "speed".
	-- Other adjustments can also be specified.
}

return {
	all_units = all_units,
	default_exceptions = default_exceptions,
	link_exceptions = link_exceptions,
	per_unit_fixups = per_unit_fixups,
}

Start a discussion about improving the Template:Convert/unit sandbox page

Start a discussion