-- 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        [[ pagename | 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  [[Hertz|baz<sub>0</sub>]]
Baz  [[Kelvins|baz<sub>0</sub>]]
Bar  [[Foobar|bar<abbr title="super duper">0</abbr>]]
quux  [[Foobar|<span title="super duper 2">bar0</span>]]

== Unsorted units ==
c0  [[Velocità della luce|''c''<sub>0</sub>]]
C.mol-1  [[Costante di Faraday|C&sdot;mol<sup>−1</sup>]]
C/mol  [[Costante di Faraday|C/mol]]
C.kg-1  [[Röntgen (unità di misura)|C&sdot;kg<sup>−1</sup>]]
C/kg  [[Röntgen (unità di misura)|C/kg]]
F.m-1  [[Costante dielettrica del vuoto|F&sdot;m<sup>−1</sup>]]
F/m  [[Costante dielettrica del vuoto|F/m]]
e  [[Carica elementaree|''e'']]
kB  [[Kilobyte|kB]]  8e3
MB  [[Megabyte|MB]]  8e6
GB  [[Gigabyte|GB]]  8e9
TB  [[Terabyte|TB]]  8e12
lx  [[Lux|lx]]

== Time and frequency ==
byte/s  [[Data rate units|byte/s]]  8
kB/s  [[Kilobit per secondo|<span title="Kilobytes per second">kB/s</span>]]  8e3
MB/s  [[Megabit per secondo|<span title="Megabytes per second">MB/s</span>]]  8e6
GB/s  [[Gigabit per secondo|<span title="Gigabytes per second">GB/s</span>]]  8e9
TB/s  [[Terabit per secondo|<span title="Terabytes per second">TB/s</span>]]  8e12
bit/s  [[Bit per secondo|bit/s]]  1
bps  [[Bit per secondo|bit/s]]  1
kbit/s  [[Kilobit per secondo|kbit/s]]  1e3
Mbit/s  [[Megabit per secondo|Mbit/s]]  1e6
Gbit/s  [[Gigabit per secondo|Gbit/s]]  1e9
Tbit/s  [[Terabit per secondo|Tbit/s]]  1e12
kT/s  [[MT/s|<span title="Kilotransfers per secondo">kT/s</span>]]  1e3
MT/s  [[MT/s|<span title="Megatransfers per secondo">MT/s</span>]]  1e6
GT/s  [[MT/s|<span title="Gigatransfers per secondo">GT/s</span>]]  1e9


kyr  [[anno|kyr]]  31557600000
kya  [[anno|kya]]  31557600000
myr  [[anno|myr]]  31557600000000
mya  [[anno|mya]]  31557600000000
byr  [[anno|byr]]  31557600000000000
bya  [[anno|bya]]  31557600000000000
Gyr  [[anno|Gyr]]  31557600000000000
BP  [[Before present|BP]]
uBP  [[Metodo del carbonio-14|<sup>14</sup>C yr BP]]
BC  [[Avanti Cristo|a.C.]]  -1
a.C.  [[Avanti Cristo|a.C.]]  -1
AD  [[Anno Domini|A.D.]]  1
BCE  [[Era volgare|e.v.]]  -1
CE  [[Era volgare|CE]]  1
e.v.  [[Era volgare|CE]]  1
JD  [[Giorno giuliano|JD]]  1

s-1  [[Secondo|s<sup>−1</sup>]]
s-2  [[Secondo|s<sup>−2</sup>]]
s2  [[Secondo|s<sup>2</sup>]]

== Length, area, volume ==
fb-1  [[Barn|fb<sup>−1</sup>]]

Gal  [[Gal|Gal]]	SI
uGal  [[Gal|µGal]]	SI
µGal  [[Gal|µGal]]	SI
mGal  [[Gal|mGal]]	SI

b  [[Barn|b]]  SI
ab  [[Barn|b]]  SI
cb  [[Barn|b]]  SI
dab  [[Barn|b]]  SI
db  [[Barn|b]]  SI
Eb  [[Barn|b]]  SI
fb  [[Barn|b]]  SI
Gb  [[Barn|b]]  SI
hb  [[Barn|b]]  SI
kb  [[Barn|b]]  SI
mb  [[Barn|b]]  SI
µb  [[Barn|b]]  SI
ub  [[Barn|b]]  SI
Mb  [[Barn|b]]  SI
nb  [[Barn|b]]  SI
pb  [[Barn|b]]  SI
Pb  [[Barn|b]]  SI
Tb  [[Barn|b]]  SI
Yb  [[Barn|b]]  SI
yb  [[Barn|b]]  SI
Zb  [[Barn|b]]  SI
zb  [[Barn|b]]  SI

== Velocity and acceleration ==

== Mass and energy ==
lbm  [[Pound (mass)|<span title="pound-mass">lb<sub>m</sub></span>]]
uJ  [[Joule|µJ]]
J.s  [[Joule-second|J&sdot;s]]
kWh  [[Kilowatt hour|kWh]]
kW.h  [[Kilowatt hour|kW&sdot;h]]
J/C  [[Volt|J/C]]
J/kg  [[Joule|J/kg]]

== Pressure and density ==

== Temperature ==
degC  °C  ALIAS
degF  °F  ALIAS
degR  °R  ALIAS

== Electromagnetism ==
Wb  [[Weber (unità di misura)|Wb]]
N.A-2  [[Permeabilità magnetica|N&sdot;A<sup>−2</sup>]]
H.m-1  [[Permeabilità magnetica|H&sdot;m<sup>−1</sup>]]
V.m-1  [[Campo elettrico|V&sdot;m<sup>−1</sup>]]
V/m  [[Campo elettrico|V/m]]

C  [[Coulomb|C]]  SI
YC  [[Coulomb|C]]  SI
ZC  [[Coulomb|C]]  SI
EC  [[Coulomb|C]]  SI
PC  [[Coulomb|C]]  SI
TC  [[Coulomb|C]]  SI
GC  [[Coulomb|C]]  SI
MC  [[Coulomb|C]]  SI
kC  [[Coulomb|C]]  SI
hC  [[Coulomb|C]]  SI
daC  [[Coulomb|C]]  SI
dC  [[Coulomb|C]]  SI
cC  [[Coulomb|C]]  SI
mC  [[Coulomb|C]]  SI
µC  [[Coulomb|C]]  SI
uC  [[Coulomb|C]]  SI
nC  [[Coulomb|C]]  SI
pC  [[Coulomb|C]]  SI
fC  [[Coulomb|C]]  SI
aC  [[Coulomb|C]]  SI
zC  [[Coulomb|C]]  SI
yC  [[Coulomb|C]]  SI

F  [[Farad|F]]  SI
YF  [[Farad|F]]  SI
ZF  [[Farad|F]]  SI
EF  [[Farad|F]]  SI
PF  [[Farad|F]]  SI
TF  [[Farad|F]]  SI
GF  [[Farad|F]]  SI
MF  [[Farad|F]]  SI
kF  [[Farad|F]]  SI
hF  [[Farad|F]]  SI
daF  [[Farad|F]]  SI
dF  [[Farad|F]]  SI
cF  [[Farad|F]]  SI
mF  [[Farad|F]]  SI
µF  [[Farad|F]]  SI
uF  [[Farad|F]]  SI
nF  [[Farad|F]]  SI
pF  [[Farad|F]]  SI
fF  [[Farad|F]]  SI
aF  [[Farad|F]]  SI
zF  [[Farad|F]]  SI
yF  [[Farad|F]]  SI

H  [[Henry (unità di misura)|H]]  SI
YH  [[Henry (unità di misura)|H]]  SI
ZH  [[Henry (unità di misura)|H]]  SI
EH  [[Henry (unità di misura)|H]]  SI
PH  [[Henry (unità di misura)|H]]  SI
TH  [[Henry (unità di misura)|H]]  SI
GH  [[Henry (unità di misura)|H]]  SI
MH  [[Henry (unità di misura)|H]]  SI
kH  [[Henry (unità di misura)|H]]  SI
hH  [[Henry (unità di misura)|H]]  SI
daH  [[Henry (unità di misura)|H]]  SI
dH  [[Henry (unità di misura)|H]]  SI
cH  [[Henry (unità di misura)|H]]  SI
mH  [[Henry (unità di misura)|H]]  SI
µH  [[Henry (unità di misura)|H]]  SI
uH  [[Henry (unità di misura)|H]]  SI
nH  [[Henry (unità di misura)|H]]  SI
pH  [[Henry (unità di misura)|H]]  SI
fH  [[Henry (unità di misura)|H]]  SI
aH  [[Henry (unità di misura)|H]]  SI
zH  [[Henry (unità di misura)|H]]  SI
yH  [[Henry (unità di misura)|H]]  SI

A  [[Ampere|A]]  SI
YA  [[Ampere|A]]  SI
ZA  [[Ampere|A]]  SI
EA  [[Ampere|A]]  SI
PA  [[Ampere|A]]  SI
TA  [[Ampere|A]]  SI
GA  [[Ampere|A]]  SI
MA  [[Ampere|A]]  SI
kA  [[Ampere|A]]  SI
hA  [[Ampere|A]]  SI
daA  [[Ampere|A]]  SI
dA  [[Ampere|A]]  SI
cA  [[Ampere|A]]  SI
mA  [[Ampere|A]]  SI
µA  [[Ampere|A]]  SI
uA  [[Ampere|A]]  SI
nA  [[Ampere|A]]  SI
pA  [[Ampere|A]]  SI
fA  [[Ampere|A]]  SI
aA  [[Ampere|A]]  SI
zA  [[Ampere|A]]  SI
yA  [[Ampere|A]]  SI

V  [[Volt|V]]  SI
YV  [[Volt|V]]  SI
ZV  [[Volt|V]]  SI
EV  [[Volt|V]]  SI
PV  [[Volt|V]]  SI
TV  [[Volt|V]]  SI
GV  [[Volt|V]]  SI
MV  [[Volt|V]]  SI
kV  [[Volt|V]]  SI
hV  [[Volt|V]]  SI
daV  [[Volt|V]]  SI
dV  [[Volt|V]]  SI
cV  [[Volt|V]]  SI
mV  [[Volt|V]]  SI
µV  [[Volt|V]]  SI
uV  [[Volt|V]]  SI
nV  [[Volt|V]]  SI
pV  [[Volt|V]]  SI
fV  [[Volt|V]]  SI
aV  [[Volt|V]]  SI
zV  [[Volt|V]]  SI
yV  [[Volt|V]]  SI

VA  [[Voltampere|VA]]  SI
YVA  [[Voltampere|VA]]  SI
ZVA  [[Voltampere|VA]]  SI
EVA  [[Voltampere|VA]]  SI
PVA  [[Voltampere|VA]]  SI
TVA  [[Voltampere|VA]]  SI
GVA  [[Voltampere|VA]]  SI
MVA  [[Voltampere|VA]]  SI
kVA  [[Voltampere|VA]]  SI
hVA  [[Voltampere|VA]]  SI
daVA  [[Voltampere|VA]]  SI
dVA  [[Voltampere|VA]]  SI
cVA  [[Voltampere|VA]]  SI
mVA  [[Voltampere|VA]]  SI
µVA  [[Voltampere|VA]]  SI
uVA  [[Voltampere|VA]]  SI
nVA  [[Voltampere|VA]]  SI
pVA  [[Voltampere|VA]]  SI
fVA  [[Voltampere|VA]]  SI
aVA  [[Voltampere|VA]]  SI
zVA  [[Voltampere|VA]]  SI
yVA  [[Voltampere|VA]]  SI

R  [[Rayleigh (unità di misura)|R]]  SI

== Astrophysics ==
c  [[velocità della luce|''c'']]
ly  [[Light-year|ly]]
massa terrestre  [[massa terrestre|M<sub>⊕</sub>]]
masse terrestri  [[massa terrestre|M<sub>⊕</sub>]]
raggio terrestre  [[raggio terrestre|r<sub>⊕</sub>]]
raggi terrestri  [[raggio terrestre|r<sub>⊕</sub>]]
massa gioviana  [[massa gioviana|M<sub>J</sub>]]
masse gioviane  [[massa gioviana|M<sub>J</sub>]]
raggio gioviano  [[raggio gioviano|r<sub>J</sub>]]
raggi gioviani  [[raggio gioviano|r<sub>J</sub>]]
massa solare  [[massa solare|M<sub>⊙</sub>]]
masse solari  [[massa solare|M<sub>⊙</sub>]]
raggio solare  [[Raggio solare|R<sub>⊙</sub>]]
raggi solari  [[Raggio solare|R<sub>⊙</sub>]]
luminosità solare  [[Luminosità solare|L<sub>⊙</sub>]]
pc2  [[Parsec|pc<sup>2</sup>]]
pc3  [[Parsec|pc<sup>3</sup>]]
kpc2  [[Parsec|kpc<sup>2</sup>]]
kpc3  [[Parsec|kpc<sup>3</sup>]]
kpc  [[Parsec|kpc]]
Mpc2  [[Parsec|Mpc<sup>2</sup>]]
Mpc3  [[Parsec|Mpc<sup>3</sup>]]
Mpc  [[Parsec|Mpc]]
Gpc2  [[Parsec|Gpc<sup>2</sup>]]
Gpc3  [[Parsec|Gpc<sup>3</sup>]]
Gpc  [[Parsec|Gpc]]

== Nuclear physics and chemistry ==
cm-1  [[Numero d'onda|cm<sup>−1</sup>]]
u  [[Unità di massa atomica|u]]
osmole  [[Osmole|Osm]]
Osm  [[Osmole|Osm]]
M  [[Concentrazione di quantità di sostanza|M]]
TM  [[Concentrazione di quantità di sostanza|M]]  SI
GM  [[Concentrazione di quantità di sostanza|M]]  SI
MM  [[Concentrazione di quantità di sostanza|M]]  SI
kM  [[Concentrazione di quantità di sostanza|M]]  SI
hM  [[Concentrazione di quantità di sostanza|M]]  SI
daM  [[Concentrazione di quantità di sostanza|M]]  SI
dM  [[Concentrazione di quantità di sostanza|M]]  SI
cM  [[Concentrazione di quantità di sostanza|M]]  SI
mM  [[Concentrazione di quantità di sostanza|M]]  SI
uM  [[Concentrazione di quantità di sostanza|M]]  1e-6
nM  [[Concentrazione di quantità di sostanza|M]]  SI
pM  [[Concentrazione di quantità di sostanza|M]]  SI
kg.mol-1  [[Massa molare|kg&sdot;mol<sup>−1</sup>]]
kg/mol  [[Massa molare|M]]
g.mol-1  [[Massa molare|g&sdot;mol<sup>−1</sup>]]
g/mol  [[Massa molare|g/mol]]
eV/c2  [[Elettronvolt|eV/''c''<sup>2</sup>]]
keV/c2  [[Elettronvolt|keV/''c''<sup>2</sup>]]
MeV/c2  [[Elettronvolt|MeV/''c''<sup>2</sup>]]
GeV/c2  [[Elettronvolt|GeV/''c''<sup>2</sup>]]
TeV/c2  [[Elettronvolt|TeV/''c''<sup>2</sup>]]
µN  [[Nuclear magneton|µ<span style="display:inline-block;margin-bottom:-0.3em;vertical-align:-0.4em;line-height:1.2em;font-size:85%;text-align:left"><br />N</span>]]
µB  [[Bohr magneton|µ<span style="display:inline-block;margin-bottom:-0.3em;vertical-align:-0.4em;line-height:1.2em;font-size:85%;text-align:left"><br />B</span>]]
eV  [[Electronvolt|eV]]
mev  [[Electronvolt|meV]]
keV  [[Electronvolt|keV]]
MeV  [[Electronvolt|MeV]]
GeV  [[Electronvolt|GeV]]
TeV  [[Electronvolt|TeV]]
mol-1  [[costante di Avogadro|mol<sup>−1</sup>]]

== Numbers and phrases ==
pp  [[Carta#Applicazioni|pp]]
ppb  [[Parti per miliardo|ppb]]  1e-9
ppm  [[Parti per milione|ppm]]  1e-6
milione  [[milione|milione]]  1e6
miliardo  [[miliardo|miliardo]]  1e9
bilione  [[blione|bilione]]  1e12
biliardo  [[Biliardo (numero)|biliardo]]  1e15
trilione  [[trilione|trilione]] 1e18
triliardo  [[triliardo|triliardo]] 1e21
quadrilione  [[quadrilione|quadrilione]] 1e24
quadriliardo  [[quadriliardo|quadriliardo]] 1e27
--eventualmente da espandere

== Angles ==
%                  %                                     Percent                                ANGLE   0.01
percento           %                                     Percent                                ANGLE   0.01
per cento          %                                     Percent                                ANGLE   0.01
‰                  ‰                                     Per mil                                ANGLE   1e-3
per mille          ‰                                     Per mil                                ANGLE   1e-3
permile            ‰                                     Per mil                                ANGLE   1e-3
°                  °                                     Degree (angle)                         ANGLE   pi/180
deg                °                                     Degree (angle)                         ANGLE   pi/180
'                  ′                                     Minute of arc                          ANGLE   pi/10800
′                  ′                                     Minute of arc                          ANGLE   pi/10800
arcminuto          ′                                     Minute of arc                          ANGLE   pi/10800
"                  ″                                     Second of arc                          ANGLE   pi/648000
″                  ″                                     Second of arc                          ANGLE   pi/648000
arcsecondo         ″                                     Second of arc                          ANGLE   pi/648000

]=]

-- If val has "|long scale=on" the following definitions are used
-- (then, if not found here, the normal definitions are used).
-- Unit code  [[Link|Symbol]]  Flags/Scale
local builtin_units_long_scale = [=[

== Long scale numbers and phrases ==
-- nell'italiano non c'è il problema di scala lunga e corta

]=]

return { builtin_units = builtin_units, builtin_units_long_scale = builtin_units_long_scale }