-- Definitions for units known to val-- File format is two strings and a return statement with them in it:-- string in quotes [=[ ... builtin_units ... ]=].-- string in quotes [=[ ... builtin_units_long_scale ... ]=].-- First string, builtin_units, is short-scale, second string is long scale.
-- Entry format:-- One record per line, starting in first column, having 2-4 fields.-- Field separator: two or more spaces-- Between first and second fields: two or more spaces-- Between all other fields: two or more spaces, or one or more tabs-- Entries without two spaces in them are ignored.
-- There must be a blank line before the first entry and after the last.-- I.e. the first two and last two characters of the string must be newlines.
-- Format of entry. Two record types:---- One record type is a wikilink:-- Unit-code Symbol-accepts-HTML-only-- Text-field separator is still two spaces. Two spaces not allowed in wikilink.---- The other record type is all fields:-- Unit-code symbol-accepts-HTML-only pagename#section-OK---- Plus there is an optional field that goes at the end after two or more spaces.-- Whether it is a number or an equation or the letters SI,-- any of these three has the same function: a wikitable sorting "scale".-- It is for sorting, and it works for either record type.-- Difference is SI can't accept HTML. But SI correctly scales any SI prefix.-- (Optional fields ALIAS and NOSPACE and ANGLE are for advanced users.)
-- "Invalid unit" error:-- Using SI requires that the symbol equal unit-code, so never allows HTML.-- Any difference between SI or symbol must be an SI prefix, such as k, M, or G.-- A space at the end of an entry is an error. No space at each EOL.
local builtin_units = [=[ == Test == Foo [[Hz|<samp>Foo</samp>]]Baz baz0Baz baz0Bar bar0quux bar0
c0 c0lbf lbFN.s N⋅sJ.K-1 J⋅K−1C.mol-1 C⋅mol−1C/mol C/molC.kg-1 C⋅kg−1C/kg C/kgF.m-1 F⋅m−1F/m F/me ekB kB 8e3KB KB 8e3MB MB 8e6GB GB 8e9TB TB 8e12lx lxnat nat
byte/s byte/s 8kB/s kB/s 8e3MB/s MB/s 8e6GB/s GB/s 8e9TB/s TB/s 8e12bit/s bit/s 1bps bit/s 1kbit/s kbit/s 1e3Mbit/s Mbit/s 1e6Gbit/s Gbit/s 1e9Tbit/s Tbit/s 1e12kT/s kT/s 1e3MT/s MT/s 1e6GT/s GT/s 1e9year year 31557600years years 31557600yr yr 31557600y y 31557600a a 31557600Ga Ga 31557600000000000Ma Ma 31557600000000ka ka 31557600000kyr kyr 31557600000kya kya 31557600000myr myr 31557600000000mya mya 31557600000000byr byr 31557600000000000bya bya 31557600000000000Gyr Gyr 31557600000000000BP BPuBP 14C yr BPBC BC -1AD AD 1BCE BCE -1CE CE 1JD JD 1MJD MJD 1
s s SIas s SIcs s SIdas s SIds s SIEs s SIfs s SIGs s SIhs s SIks s SIms s SIµs s SIus s SIMs s SIns s SIps s SIPs s SITs s SIYs s SIys s SIZs s SIzs s SI
Hz Hz SIaHz Hz SIcHz Hz SIdaHz Hz SIdHz Hz SIEHz Hz SIfHz Hz SIhHz Hz SIGHz Hz SIkHz Hz SIMHz Hz SImHz Hz SIuHz Hz SIµHz Hz SInHz Hz SIpHz Hz SIPHz Hz SITHz Hz SIyHz Hz SIYHz Hz SIzHz Hz SIZHz Hz SI
ips ips
Å3 Å3fb-1 fb−1m-1 m−1m-2 m−2m-3 m−3km2 km2km3 km3µm2 µm2um2 µm2am2 am2cm2 cm2dam2 dam2dm2 dm2Em2 Em2fm2 fm2Gm2 Gm2hm2 hm2mm2 mm2Mm2 Mm2nm2 nm2pm2 pm2Pm2 Pm2Tm2 Tm2ym2 ym2Ym2 Ym2zm2 zm2Zm2 Zm2gal galGal GaluGal µGalµGal µGalmGal mGal
b b SIab b SIcb b SIdab b SIdb b SIEb b SIfb b SIGb b SIhb b SIkb b SImb b SIµb b SIub b SIMb b SInb b SIpb b SIPb b SITb b SIYb b SIyb b SIZb b SIzb b SI
m.s-2 m⋅s−2m/s2 m/s2m.s-1 m⋅s−1m/s m/skm.s-1 km⋅s−1km/s km/s
lbm lbmuJ µJJ.s J⋅skWh kWhkW.h kW⋅hJ/C J/CJ/kg J/kg
Da Da SIEDa Da SIPDa Da SITDa Da SIGDa Da SIMDa Da SIkDa Da SImDa Da SIuDa Da SIµDa Da SInDa Da SIpDa Da SIfDa Da SIaDa Da SI
g g SIag g SIcg g SIdag g SIdg g SIEg g SIfg g SIGg g SIhg g SIkg g SImcg g SIMg g SImg g SIug g SIµg g SIng g SIPg g SIpg g SITg g SIyg g SIYg g SIzg g SIZg g SI
psi psig.cm-3 g⋅cm−3g/cm3 g/cm3kg.m-3 kg⋅m−3kg/m3 kg/m3kg/cm3 kg/cm3g/L g/Lg/l g/lmcg/dL µg/dLmcg/dl µg/dlmg/mL mg/mLmg/ml mg/mlug/dL µg/dLug/dl µg/dlμg/dL μg/dLμg/dl μg/dlmg.L-1 mg/Lmg/L mg/Lmg.l-1 mg/lmg/l mg/l
MPa.m.5 MPa⋅m1/2kPa.m.5 kPa⋅m1/2Pa.m.5 Pa⋅m1/2
degC °C ALIASdegF °F ALIASdegR °R ALIAS
K K SIYK K SIZK K SIEK K SIPK K SITK K SIGK K SIMK K SIkK K SIhK K SIdaK K SIdK K SIcK K SImK K SIµK K SIuK K SInK K SIpK K SIfK K SIaK K SIzK K SIyK K SI
Wb WbN.A-2 N⋅A−2H.m-1 H⋅m−1V.m-1 V⋅m−1V/m V/m
C C SIYC C SIZC C SIEC C SIPC C SITC C SIGC C SIMC C SIkC C SIhC C SIdaC C SIdC C SIcC C SImC C SIµC C SIuC C SInC C SIpC C SIfC C SIaC C SIzC C SIyC C SI
F F SIYF F SIZF F SIEF F SIPF F SITF F SIGF F SIMF F SIkF F SIhF F SIdaF F SIdF F SIcF F SImF F SIµF F SIuF F SInF F SIpF F SIfF F SIaF F SIzF F SIyF F SI
H H SIYH H SIZH H SIEH H SIPH H SITH H SIGH H SIMH H SIkH H SIhH H SIdaH H SIdH H SIcH H SImH H SIµH H SIuH H SInH H SIpH H SIfH H SIaH H SIzH H SIyH H SI
A A SIYA A SIZA A SIEA A SIPA A SITA A SIGA A SIMA A SIkA A SIhA A SIdaA A SIdA A SIcA A SImA A SIµA A SIuA A SInA A SIpA A SIfA A SIaA A SIzA A SIyA A SI
V V SIYV V SIZV V SIEV V SIPV V SITV V SIGV V SIMV V SIkV V SIhV V SIdaV V SIdV V SIcV V SImV V SIµV V SIuV V SInV V SIpV V SIfV V SIaV V SIzV V SIyV V SI
VA VA SIYVA VA SIZVA VA SIEVA VA SIPVA VA SITVA VA SIGVA VA SIMVA VA SIkVA VA SIhVA VA SIdaVA VA SIdVA VA SIcVA VA SImVA VA SIµVA VA SIuVA VA SInVA VA SIpVA VA SIfVA VA SIaVA VA SIzVA VA SIyVA VA SI
Ω Ω SI
YΩ.m YΩ⋅m 1e24ZΩ.m ZΩ⋅m 1e21EΩ.m EΩ⋅m 1e18PΩ.m PΩ⋅m 1e15TΩ.m TΩ⋅m 1e12GΩ.m GΩ⋅m 1e9MΩ.m MΩ⋅m 1e6kΩ.m kΩ⋅m 1e3Ω.m Ω⋅m 1mΩ.m mΩ⋅m 1e-3µΩ.m µΩ⋅m 1e-6uΩ.m µΩ⋅m 1e-6nΩ.m nΩ⋅m 1e-9pΩ.m pΩ⋅m 1e-12fΩ.m fΩ⋅m 1e-15aΩ.m aΩ⋅m 1e-18zΩ.m zΩ⋅m 1e-21yΩ.m yΩ⋅m 1e-24
R R SI
G G SIaG G SIcG G SIdaG G SIdG G SIEG G SIfG G SIGG G SIhG G SIkG G SIMG G SImG G SIuG G SIµG G SInG G SIPG G SIpG G SITG G SIyG G SIYG G SIzG G SIZG G SI
T T SIaT T SIcT T SIdaT T SIdT T SIET T SIfT T SIGT T SIhT T SIkT T SIMT T SImT T SIuT T SIµT T SInT T SIPT T SIpT T SITT T SIyT T SIYT T SIzT T SIZT T SI
au auc cly lyEarth mass MEarth radius RM_Earth MR_Earth RM+ MR+ RJupiter mass MJJupiter radius RJJy JyM_Jupiter MJR_Jupiter RJSolar mass M☉solar mass M☉M_Solar M☉M_solar M☉R_Solar R☉R_solar R☉Solar radius R☉solar radius R☉Solar luminosity L☉solar luminosity L☉L_solar L☉L_Solar L☉Lo L☉pc2 pc2pc3 pc3kpc2 kpc2kpc3 kpc3kpc kpcMpc2 Mpc2Mpc3 Mpc3Mpc MpcGpc2 Gpc2Gpc3 Gpc3Gpc Gpc
cm-1 cm−1u uosmol osmolOsm OsmM MTM M SIGM M SIMM M SIkM M SIhM M SIdaM M SIdM M SIcM M SImM M SIuM M 1e-6nM M SIpM M SIkg.mol-1 kg⋅mol−1kg/mol kg/molg.mol-1 g⋅mol−1g/mol g/moleV/c2 eV/c2keV/c2 keV/c2MeV/c2 MeV/c2GeV/c2 GeV/c2TeV/c2 TeV/c2eV eVmeV meVkeV keVMeV MeVGeV GeVTeV TeVmol-1 mol−1J.mol-1 J⋅mol−1J/mol J/molkJ.mol-1 kJ⋅mol−1kJ/mol kJ/molMJ.mol-1 MJ⋅mol−1MJ/mol MJ/molGJ.mol-1 GJ⋅mol−1GJ/mol GJ/molTJ.mol-1 TJ⋅mol−1TJ/mol TJ/mol
pp ppppb ppb 1e-9ppm ppm 1e-6billiard billiard 1e15billion billion 1e9billionth billionth 1e-9billionths billionths 1e-9decilliard decilliard 1e63decillion decillion 1e33decillionth decillionth 1e-33decillionths decillionths 1e-33milliard milliard 1e9million million 1e6millionth millionth 1e-6millionths millionths 1e-6nonilliard nonilliard 1e57nonillion nonillion 1e30nonillionth nonillionth 1e-30nonillionths nonillionths 1e-30octilliard octilliard 1e51octillion octillion 1e27octillionth octillionth 1e-27octillionths octillionths 1e-27quadrilliard quadrilliard 1e27quadrillion quadrillion 1e15quadrillionth quadrillionth 1e-15quadrillionths quadrillionths 1e-15quintilliard quintilliard 1e33quintillion quintillion 1e18quintillionth quintillionth 1e-18quintillionths quintillionths 1e-18septilliard septilliard 1e45septillion septillion 1e24septillionth septillionth 1e-24septillionths septillionths 1e-24sextilliard sextilliard 1e39sextillion sextillion 1e21sextillionth sextillionth 1e-21sextillionths sextillionths 1e-21trilliard trilliard 1e21trillion trillion 1e12trillionth trillionth 1e-12trillionths trillionths 1e-12
% % Percent ANGLE 0.01percent % Percent ANGLE 0.01per cent % Percent ANGLE 0.01‰ ‰ Per mil ANGLE 1e-3per mil ‰ Per mil ANGLE 1e-3per mill ‰ Per mil ANGLE 1e-3per mille ‰ Per mil ANGLE 1e-3permil ‰ Per mil ANGLE 1e-3permill ‰ Per mil ANGLE 1e-3permille ‰ Per mil ANGLE 1e-3° ° Degree (angle) ANGLE pi/180deg ° Degree (angle) ANGLE pi/180degree ° Degree (angle) NOSPACE pi/180' ′ Minute of arc ANGLE pi/10800′ ′ Minute of arc ANGLE pi/10800arcmin ′ Minute of arc ANGLE pi/10800arcminute ′ Minute of arc ANGLE pi/10800" ″ Second of arc ANGLE pi/648000″ ″ Second of arc ANGLE pi/648000arcsec ″ Second of arc ANGLE pi/648000arcsecond ″ Second of arc ANGLE pi/648000mas mas pi/648000000
]=]
-- If val has "|long scale=on" the following definitions are used-- (then, if not found here, the normal definitions are used).-- Unit code Symbol Flags/Scalelocal builtin_units_long_scale = [=[ == Long scale numbers and phrases == billion [[Orders of magnitude (numbers)#1012|billion]] 1e12billionth billionth 1e-12billionths billionths 1e-12decillion decillion 1e60decillionth decillionth 1e-60decillionths decillionths 1e-60nonillion nonillion 1e54nonillionth nonillionth 1e-54nonillionths nonillionths 1e-54octillion octillion 1e48octillionth octillionth 1e-48octillionths octillionths 1e-48quadrillion quadrillion 1e24quadrillionth quadrillionth 1e-24quadrillionths quadrillionths 1e-24quintillion quintillion 1e30quintillionth quintillionth 1e-30quintillionths quintillionths 1e-30septillion septillion 1e42septillionth septillionth 1e-42septillionths septillionths 1e-42sextillion sextillion 1e36sextillionth sextillionth 1e-36sextillionths sextillionths 1e-36trillion trillion 1e18trillionth trillionth 1e-18trillionths trillionths 1e-18
]=]
return