Module:Sandbox/RexxS/Units

-- This module creates a table of tables

-- principally intended for converting the Wikidata QID of a unit into the code used by {{convert}}

--

-- It is meant to be imported with require() into other modules where it will make available:

-- e.g. unitByQid["Q11573"]["convertcode"] which has the value 'm'

-- e.g. unitByQid["Q11573"]["singular"] which has the value 'metre'

--

-- unitByQid will become a table in the scope of wherever it is called

-- Note: module formerly had entries for abbreviation, but {{convert}} is best placed to handle that

local s = "singular"

local p = "plural"

local c = "convertcode"

unitByQid = {

["Q11573"]={

[s]="metre",

[c]="m",

},

["Q25343"]={

[s]="square metre",

[c]="m2",

},

["Q3710"]={

[s]="foot",

[p]="feet",

[c]="ft",

},

["Q857027"]={

[s]="square foot",

[p]="square feet",

[c]="sqft",

},

["Q828224"]={

[s]="kilometre",

[c]="km",

},

["Q253276"]={

[s]="mile",

[c]="mi",

},

["Q11582"]={

[s]="litre",

[c]="l",

},

["Q23925413"]={

[s]="US gallon",

[c]="USgal",

},

["Q11570"]={

[s]="kilogram",

[c]="kg",

},

["Q100995"]={

[s]="pound",

[c]="lb",

},

["Q44395"]={

[s]="pascal",

[c]="Pa",

},

["Q626299"]={

[s]="pound per square inch",

[p]="pounds per square inch",

[c]="psi",

},

}