Module:Convert/extra: Difference between revisions

Source: Wikipedia, the free encyclopedia.
Content deleted Content added
add "inches" alias per talk request; this means most common units have plural aliases
Kavuldra (talk | contribs)
added basic units of information to automate the conversion to and from bits & bytes and ease the conversion between information density units.
Line 29: Line 29:
["inches"] = {
["inches"] = {
target = "in",
target = "in",
},
["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",
},
},
}
}

Revision as of 15:42, 11 August 2022

-- Extra conversion data used by Module:Convert.
--
-- [[Module:Convert/data]] defines all units and is transcluded in all pages
-- where [[Module:Convert]] is used. Testing new units by editing that module
-- would invalidate the cache for all affected pages.
--
-- For quick changes and experiments with new units, this module can be edited.
-- Since this module is transcluded in only a small number of pages, changes
-- should cause little server overhead and should propagate quickly.
--
-- If a unit is defined in the data module, any definition here is ignored,
-- so defining the same unit in both modules is not an error.
-- A unit defined here can refer to units that are also defined here, and
-- can refer to units defined in the data module.
--
-- Periodically, those extra units that are wanted permanently can be removed
-- from here after being added to [[Module:Convert/data]].

local extra_units = {
    ["sec"] = {  -- experiment per request at [[Template talk:Convert#Auto-select time unit?]]
	_name1   = "second",
	_symbol  = "s",
	utype    = "time",
	scale    = 1,
	prefixes = 1,
	default  = "v < 7200 ! min ! h",
	link     = "Second",
    },
    ["inches"] = {
	target   = "in",
    },
    ["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",
    },
}

return { extra_units = extra_units }