asciimath2unitsml 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +14 -0
- data/README.adoc +4 -1
- data/asciimath2unitsml.gemspec +1 -1
- data/lib/asciimath2unitsml/conv.rb +48 -17
- data/lib/asciimath2unitsml/parse.rb +14 -22
- data/lib/asciimath2unitsml/render.rb +12 -5
- data/lib/asciimath2unitsml/unit.rb +1 -1
- data/lib/asciimath2unitsml/version.rb +1 -1
- data/lib/unitsdb/dimensions.yaml +31 -31
- data/lib/unitsdb/quantities.yaml +26 -19
- data/lib/unitsdb/units.yaml +27 -217
- data/lib/unitsdb_ruby/unitsdb.rb +1 -0
- data/spec/conv_spec.rb +339 -109
- metadata +8 -6
data/lib/unitsdb/units.yaml
CHANGED
@@ -1745,6 +1745,7 @@
|
|
1745
1745
|
dimension_url: "#NISTd15"
|
1746
1746
|
short:
|
1747
1747
|
root: false
|
1748
|
+
prefixed: true
|
1748
1749
|
unit_system:
|
1749
1750
|
type: "non-SI_acceptable"
|
1750
1751
|
name: "non-SI"
|
@@ -1817,26 +1818,6 @@
|
|
1817
1818
|
- name: "potential energy"
|
1818
1819
|
url: "#NISTq77"
|
1819
1820
|
|
1820
|
-
"NISTu132":
|
1821
|
-
dimension_url: "#NISTd85"
|
1822
|
-
short:
|
1823
|
-
root: false
|
1824
|
-
unit_system:
|
1825
|
-
type: "SI_derived_non-special"
|
1826
|
-
name: "SI"
|
1827
|
-
unit_name:
|
1828
|
-
- "one"
|
1829
|
-
unit_symbols:
|
1830
|
-
- id: "1"
|
1831
|
-
ascii: "1"
|
1832
|
-
html: "1"
|
1833
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
1834
|
-
latex: \ensuremath{\mathrm{1}}
|
1835
|
-
unicode: "1"
|
1836
|
-
quantity_reference:
|
1837
|
-
- name: "logarithmic decrement"
|
1838
|
-
url: "#NISTq121"
|
1839
|
-
|
1840
1821
|
"NISTu63":
|
1841
1822
|
dimension_url: "#NISTd15"
|
1842
1823
|
short: table_kg_calorie
|
@@ -2066,6 +2047,7 @@
|
|
2066
2047
|
dimension_url: "#NISTd16"
|
2067
2048
|
short:
|
2068
2049
|
root: false
|
2050
|
+
prefixed: true
|
2069
2051
|
unit_system:
|
2070
2052
|
type: "non-SI_not_acceptable"
|
2071
2053
|
name: "non-SI"
|
@@ -2418,6 +2400,7 @@
|
|
2418
2400
|
dimension_url: "#NISTd14"
|
2419
2401
|
short:
|
2420
2402
|
root: false
|
2403
|
+
prefixed: true
|
2421
2404
|
unit_system:
|
2422
2405
|
type: "non-SI_not_acceptable"
|
2423
2406
|
name: "non-SI"
|
@@ -3521,6 +3504,26 @@
|
|
3521
3504
|
quantity_reference:
|
3522
3505
|
- name: "refractive index"
|
3523
3506
|
url: "#NISTq93"
|
3507
|
+
- name: "rotation"
|
3508
|
+
url: "#NISTq111"
|
3509
|
+
- name: "relative permeability"
|
3510
|
+
url: "#NISTq94"
|
3511
|
+
- name: "relative mass density"
|
3512
|
+
url: "#NISTq125"
|
3513
|
+
- name: "linear strain"
|
3514
|
+
url: "#NISTq136"
|
3515
|
+
- name: "shear strain"
|
3516
|
+
url: "#NISTq137"
|
3517
|
+
- name: "volume strain"
|
3518
|
+
url: "#NISTq138"
|
3519
|
+
- name: "Poisson number"
|
3520
|
+
url: "#NISTq140"
|
3521
|
+
- name: "dynamic friction factor"
|
3522
|
+
url: "#NISTq147"
|
3523
|
+
- name: "logarithmic decrement"
|
3524
|
+
url: "#NISTq121"
|
3525
|
+
- name: "nil"
|
3526
|
+
url: "#NISTq1002"
|
3524
3527
|
|
3525
3528
|
"NISTu166":
|
3526
3529
|
dimension_url: "#NISTd15"
|
@@ -4337,8 +4340,8 @@
|
|
4337
4340
|
unit_symbols:
|
4338
4341
|
- id: "deg"
|
4339
4342
|
ascii: "deg"
|
4340
|
-
html: "&#
|
4341
|
-
mathml: "<mi mathvariant='normal'>&#
|
4343
|
+
html: "°"
|
4344
|
+
mathml: "<mi mathvariant='normal'>°</mi>"
|
4342
4345
|
latex: \ensuremath{\mathrm{^{\circ}}}
|
4343
4346
|
unicode: "º"
|
4344
4347
|
root_units:
|
@@ -5053,26 +5056,6 @@
|
|
5053
5056
|
- name: "volume"
|
5054
5057
|
url: "#NISTq10"
|
5055
5058
|
|
5056
|
-
"NISTu181":
|
5057
|
-
dimension_url: "#NISTd82"
|
5058
|
-
short:
|
5059
|
-
root: false
|
5060
|
-
unit_system:
|
5061
|
-
type: "SI_derived_non-special"
|
5062
|
-
name: "SI"
|
5063
|
-
unit_name:
|
5064
|
-
- "one"
|
5065
|
-
unit_symbols:
|
5066
|
-
- id: "1"
|
5067
|
-
ascii: "1"
|
5068
|
-
html: "1"
|
5069
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
5070
|
-
latex: \ensuremath{\mathrm{1}}
|
5071
|
-
unicode: "1"
|
5072
|
-
quantity_reference:
|
5073
|
-
- name: "rotation"
|
5074
|
-
url: "#NISTq111"
|
5075
|
-
|
5076
5059
|
"NISTu175":
|
5077
5060
|
dimension_url: "#NISTd10"
|
5078
5061
|
short: us_gallon
|
@@ -5230,26 +5213,6 @@
|
|
5230
5213
|
- name: "volume"
|
5231
5214
|
url: "#NISTq10"
|
5232
5215
|
|
5233
|
-
"NISTu174":
|
5234
|
-
dimension_url: "#NISTd81"
|
5235
|
-
short:
|
5236
|
-
root: false
|
5237
|
-
unit_system:
|
5238
|
-
type: "SI_derived_non-special"
|
5239
|
-
name: "SI"
|
5240
|
-
unit_name:
|
5241
|
-
- "one"
|
5242
|
-
unit_symbols:
|
5243
|
-
- id: "1"
|
5244
|
-
ascii: "1"
|
5245
|
-
html: "1"
|
5246
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
5247
|
-
latex: \ensuremath{\mathrm{1}}
|
5248
|
-
unicode: "1"
|
5249
|
-
quantity_reference:
|
5250
|
-
- name: "relative permeability"
|
5251
|
-
url: "#NISTq94"
|
5252
|
-
|
5253
5216
|
"NISTu182":
|
5254
5217
|
dimension_url: "#NISTd1"
|
5255
5218
|
short: light_year
|
@@ -10021,6 +9984,7 @@
|
|
10021
9984
|
dimension_url: "#NISTd56"
|
10022
9985
|
short:
|
10023
9986
|
root: false
|
9987
|
+
prefixed: true
|
10024
9988
|
unit_system:
|
10025
9989
|
type: "non-SI_not_acceptable"
|
10026
9990
|
name: "non-SI"
|
@@ -10378,160 +10342,6 @@
|
|
10378
10342
|
- name: "molality of solute B"
|
10379
10343
|
url: "#NISTq179"
|
10380
10344
|
|
10381
|
-
"NISTu368":
|
10382
|
-
dimension_url: "#NISTd86"
|
10383
|
-
short:
|
10384
|
-
root: false
|
10385
|
-
unit_system:
|
10386
|
-
type: "SI_derived_non-special"
|
10387
|
-
name: "SI"
|
10388
|
-
unit_name:
|
10389
|
-
- "one"
|
10390
|
-
unit_symbols:
|
10391
|
-
- id: "1"
|
10392
|
-
ascii: "1"
|
10393
|
-
html: "1"
|
10394
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
10395
|
-
latex: \ensuremath{\mathrm{1}}
|
10396
|
-
unicode: "1"
|
10397
|
-
quantity_reference:
|
10398
|
-
- name: "relative mass density"
|
10399
|
-
url: "#NISTq125"
|
10400
|
-
|
10401
|
-
"NISTu369":
|
10402
|
-
dimension_url: "#NISTd87"
|
10403
|
-
short:
|
10404
|
-
root: false
|
10405
|
-
unit_system:
|
10406
|
-
type: "SI_derived_non-special"
|
10407
|
-
name: "SI"
|
10408
|
-
unit_name:
|
10409
|
-
- "one"
|
10410
|
-
unit_symbols:
|
10411
|
-
- id: "1"
|
10412
|
-
ascii: "1"
|
10413
|
-
html: "1"
|
10414
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
10415
|
-
latex: \ensuremath{\mathrm{1}}
|
10416
|
-
unicode: "1"
|
10417
|
-
quantity_reference:
|
10418
|
-
- name: "linear strain"
|
10419
|
-
url: "#NISTq136"
|
10420
|
-
|
10421
|
-
"NISTu370":
|
10422
|
-
dimension_url: "#NISTd88"
|
10423
|
-
short:
|
10424
|
-
root: false
|
10425
|
-
unit_system:
|
10426
|
-
type: "SI_derived_non-special"
|
10427
|
-
name: "SI"
|
10428
|
-
unit_name:
|
10429
|
-
- "one"
|
10430
|
-
unit_symbols:
|
10431
|
-
- id: "1"
|
10432
|
-
ascii: "1"
|
10433
|
-
html: "1"
|
10434
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
10435
|
-
latex: \ensuremath{\mathrm{1}}
|
10436
|
-
unicode: "1"
|
10437
|
-
quantity_reference:
|
10438
|
-
- name: "shear strain"
|
10439
|
-
url: "#NISTq137"
|
10440
|
-
|
10441
|
-
"NISTu371":
|
10442
|
-
dimension_url: "#NISTd89"
|
10443
|
-
short:
|
10444
|
-
root: false
|
10445
|
-
unit_system:
|
10446
|
-
type: "SI_derived_non-special"
|
10447
|
-
name: "SI"
|
10448
|
-
unit_name:
|
10449
|
-
- "one"
|
10450
|
-
unit_symbols:
|
10451
|
-
- id: "1"
|
10452
|
-
ascii: "1"
|
10453
|
-
html: "1"
|
10454
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
10455
|
-
latex: \ensuremath{\mathrm{1}}
|
10456
|
-
unicode: "1"
|
10457
|
-
quantity_reference:
|
10458
|
-
- name: "volume strain"
|
10459
|
-
url: "#NISTq138"
|
10460
|
-
|
10461
|
-
"NISTu372":
|
10462
|
-
dimension_url: "#NISTd90"
|
10463
|
-
short:
|
10464
|
-
root: false
|
10465
|
-
unit_system:
|
10466
|
-
type: "SI_derived_non-special"
|
10467
|
-
name: "SI"
|
10468
|
-
unit_name:
|
10469
|
-
- "one"
|
10470
|
-
unit_symbols:
|
10471
|
-
- id: "1"
|
10472
|
-
ascii: "1"
|
10473
|
-
html: "1"
|
10474
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
10475
|
-
latex: \ensuremath{\mathrm{1}}
|
10476
|
-
unicode: "1"
|
10477
|
-
quantity_reference:
|
10478
|
-
- name: "Poisson number"
|
10479
|
-
url: "#NISTq140"
|
10480
|
-
|
10481
|
-
"NISTu373":
|
10482
|
-
dimension_url: "#NISTd91"
|
10483
|
-
short:
|
10484
|
-
root: false
|
10485
|
-
unit_system:
|
10486
|
-
type: "SI_derived_non-special"
|
10487
|
-
name: "SI"
|
10488
|
-
unit_name:
|
10489
|
-
- "one"
|
10490
|
-
unit_symbols:
|
10491
|
-
- id: "1"
|
10492
|
-
ascii: "1"
|
10493
|
-
html: "1"
|
10494
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
10495
|
-
latex: \ensuremath{\mathrm{1}}
|
10496
|
-
unicode: "1"
|
10497
|
-
quantity_reference:
|
10498
|
-
- name: "dynamic friction factor"
|
10499
|
-
url: "#NISTq147"
|
10500
|
-
|
10501
|
-
"NISTu374":
|
10502
|
-
dimension_url: "#NISTd92"
|
10503
|
-
short:
|
10504
|
-
root: false
|
10505
|
-
unit_system:
|
10506
|
-
type: "SI_derived_non-special"
|
10507
|
-
name: "SI"
|
10508
|
-
unit_name:
|
10509
|
-
- "one"
|
10510
|
-
unit_symbols:
|
10511
|
-
- id: "1"
|
10512
|
-
ascii: "1"
|
10513
|
-
html: "1"
|
10514
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
10515
|
-
latex: \ensuremath{\mathrm{1}}
|
10516
|
-
unicode: "1"
|
10517
|
-
|
10518
|
-
"NISTu375":
|
10519
|
-
dimension_url: "#NISTd93"
|
10520
|
-
short:
|
10521
|
-
root: false
|
10522
|
-
unit_system:
|
10523
|
-
type: "SI_derived_non-special"
|
10524
|
-
name: "SI"
|
10525
|
-
unit_name:
|
10526
|
-
- "one"
|
10527
|
-
unit_symbols:
|
10528
|
-
- id: "1"
|
10529
|
-
ascii: "1"
|
10530
|
-
html: "1"
|
10531
|
-
mathml: "<mi mathvariant='normal'>1</mi>"
|
10532
|
-
latex: \ensuremath{\mathrm{1}}
|
10533
|
-
unicode: "1"
|
10534
|
-
|
10535
10345
|
"NISTu376":
|
10536
10346
|
dimension_url: "#NISTd1"
|
10537
10347
|
short: light_week
|
@@ -10633,7 +10443,7 @@
|
|
10633
10443
|
url: "#NISTq1"
|
10634
10444
|
|
10635
10445
|
"NISTu400":
|
10636
|
-
dimension_url: "#
|
10446
|
+
dimension_url: "#NISTd80"
|
10637
10447
|
short:
|
10638
10448
|
root: false
|
10639
10449
|
unit_system:
|
data/lib/unitsdb_ruby/unitsdb.rb
CHANGED
@@ -135,6 +135,7 @@ module UnitsDB
|
|
135
135
|
@root = hash[:root_units][:enumerated_root_units]
|
136
136
|
hash[:quantity_reference] and @quantities = hash[:quantity_reference].map { |x| x[:url].sub(/^#/, "") }
|
137
137
|
hash[:si_derived_bases] and @si_derived_bases = hash[:si_derived_bases]
|
138
|
+
@prefixed = (hash[:prefixed] == true)
|
138
139
|
rescue
|
139
140
|
raise StandardError.new "Parse fail on Unit #{id}: #{hash}"
|
140
141
|
end
|
data/spec/conv_spec.rb
CHANGED
@@ -22,7 +22,7 @@ RSpec.describe Asciimath2UnitsML do
|
|
22
22
|
</mrow>
|
23
23
|
</msup>
|
24
24
|
</mrow>
|
25
|
-
<Unit xmlns='
|
25
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_mm.s-2' dimensionURL='#NISTd28'>
|
26
26
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
27
27
|
<UnitName xml:lang='en'>mm*s^-2</UnitName>
|
28
28
|
<UnitSymbol type='HTML'>
|
@@ -51,14 +51,14 @@ RSpec.describe Asciimath2UnitsML do
|
|
51
51
|
<EnumeratedRootUnit unit='second' powerNumerator='-2'/>
|
52
52
|
</RootUnits>
|
53
53
|
</Unit>
|
54
|
-
<Prefix xmlns='
|
54
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-3' xml:id='NISTp10_-3'>
|
55
55
|
<PrefixName xml:lang='en'>milli</PrefixName>
|
56
56
|
<PrefixSymbol type='ASCII'>m</PrefixSymbol>
|
57
57
|
<PrefixSymbol type='unicode'>m</PrefixSymbol>
|
58
58
|
<PrefixSymbol type='LaTeX'>m</PrefixSymbol>
|
59
59
|
<PrefixSymbol type='HTML'>m</PrefixSymbol>
|
60
60
|
</Prefix>
|
61
|
-
<Dimension xmlns='
|
61
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd28'>
|
62
62
|
<Length symbol='L' powerNumerator='1'/>
|
63
63
|
<Time symbol='T' powerNumerator='-2'/>
|
64
64
|
</Dimension>
|
@@ -66,7 +66,7 @@ RSpec.describe Asciimath2UnitsML do
|
|
66
66
|
OUTPUT
|
67
67
|
end
|
68
68
|
|
69
|
-
|
69
|
+
it "deals with non-Ascii units and prefixes" do
|
70
70
|
expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
|
71
71
|
1 "unitsml(um)"
|
72
72
|
INPUT
|
@@ -75,16 +75,16 @@ RSpec.describe Asciimath2UnitsML do
|
|
75
75
|
<mn>1</mn>
|
76
76
|
<mo rspace='thickmathspace'>⁢</mo>
|
77
77
|
<mrow xref='U_um'>
|
78
|
-
<mi mathvariant='normal'
|
78
|
+
<mi mathvariant='normal'>µm</mi>
|
79
79
|
</mrow>
|
80
|
-
<Unit xmlns='
|
80
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_um' dimensionURL='#NISTd1'>
|
81
81
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
82
82
|
<UnitName xml:lang='en'>um</UnitName>
|
83
83
|
<UnitSymbol type='HTML'>um</UnitSymbol>
|
84
84
|
<UnitSymbol type='MathML'>
|
85
85
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
86
86
|
<mrow>
|
87
|
-
<mi mathvariant='normal'
|
87
|
+
<mi mathvariant='normal'>µm</mi>
|
88
88
|
</mrow>
|
89
89
|
</math>
|
90
90
|
</UnitSymbol>
|
@@ -92,77 +92,196 @@ RSpec.describe Asciimath2UnitsML do
|
|
92
92
|
<EnumeratedRootUnit unit='meter' prefix='u'/>
|
93
93
|
</RootUnits>
|
94
94
|
</Unit>
|
95
|
-
<Prefix xmlns='
|
95
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-6' xml:id='NISTp10_-6'>
|
96
96
|
<PrefixName xml:lang='en'>micro</PrefixName>
|
97
97
|
<PrefixSymbol type='ASCII'>u</PrefixSymbol>
|
98
98
|
<PrefixSymbol type='unicode'>μ</PrefixSymbol>
|
99
99
|
<PrefixSymbol type='LaTeX'>$mu$</PrefixSymbol>
|
100
|
-
<PrefixSymbol type='HTML'
|
100
|
+
<PrefixSymbol type='HTML'>µ</PrefixSymbol>
|
101
101
|
</Prefix>
|
102
|
-
<Dimension xmlns='
|
102
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd1'>
|
103
103
|
<Length symbol='L' powerNumerator='1'/>
|
104
104
|
</Dimension>
|
105
105
|
</math>
|
106
106
|
OUTPUT
|
107
107
|
end
|
108
108
|
|
109
|
-
|
109
|
+
it "does not insert space before non-alphabetic units" do
|
110
110
|
expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
|
111
|
-
1 "unitsml(degK)" + 1 "unitsml(prime)"
|
111
|
+
1 "unitsml(degK)" + 1 "unitsml(prime)" + ii(theta) = s//r "unitsml(rad)" + 10^(12) "unitsml(Hz)"
|
112
112
|
INPUT
|
113
113
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
114
|
+
<mn>1</mn>
|
115
|
+
<mo rspace='thickmathspace'>⁢</mo>
|
116
|
+
<mrow xref='U_NISTu5'>
|
117
|
+
<mi mathvariant='normal'>°K</mi>
|
118
|
+
</mrow>
|
119
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu5' dimensionURL='#NISTd5'>
|
120
|
+
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
121
|
+
<UnitName xml:lang='en'>kelvin</UnitName>
|
122
|
+
<UnitSymbol type='HTML'>K</UnitSymbol>
|
123
|
+
<UnitSymbol type='MathML'>
|
124
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
125
|
+
<mrow>
|
126
|
+
<mi mathvariant='normal'>K</mi>
|
127
|
+
</mrow>
|
128
|
+
</math>
|
129
|
+
</UnitSymbol>
|
130
|
+
</Unit>
|
131
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd5'>
|
132
|
+
<ThermodynamicTemperature symbol='Theta' powerNumerator='1'/>
|
133
|
+
</Dimension>
|
134
|
+
<Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq5' dimensionURL='#NISTd5' quantityType='base'>
|
135
|
+
<QuantityName xml:lang='en-US'>thermodynamic temperature</QuantityName>
|
136
|
+
</Quantity>
|
137
|
+
<mo>+</mo>
|
138
|
+
<mn>1</mn>
|
139
|
+
<mo>⁢</mo>
|
140
|
+
<mrow xref='U_NISTu147'>
|
141
|
+
<mi mathvariant='normal'>′</mi>
|
142
|
+
</mrow>
|
143
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu147'>
|
144
|
+
<UnitSystem name='not_SI' type='not_SI' xml:lang='en-US'/>
|
145
|
+
<UnitName xml:lang='en'>minute (minute of arc)</UnitName>
|
146
|
+
<UnitSymbol type='HTML'>′</UnitSymbol>
|
147
|
+
<UnitSymbol type='MathML'>
|
148
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
149
|
+
<mrow>
|
150
|
+
<mi mathvariant='normal'>′</mi>
|
151
|
+
</mrow>
|
152
|
+
</math>
|
153
|
+
</UnitSymbol>
|
154
|
+
</Unit>
|
155
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd9'>
|
156
|
+
<PlaneAngle symbol='Phi' powerNumerator='1'/>
|
157
|
+
</Dimension>
|
158
|
+
<Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq9' dimensionURL='#NISTd9' quantityType='base'>
|
159
|
+
<QuantityName xml:lang='en-US'>plane angle</QuantityName>
|
160
|
+
<QuantityName xml:lang='en-US'>angle</QuantityName>
|
161
|
+
</Quantity>
|
162
|
+
<mo>+</mo>
|
163
|
+
<mstyle mathvariant='italic'>
|
164
|
+
<mi>θ</mi>
|
165
|
+
</mstyle>
|
166
|
+
<mo>=</mo>
|
167
|
+
<mi>s</mi>
|
168
|
+
<mo>/</mo>
|
169
|
+
<mi>r</mi>
|
170
|
+
<mo rspace='thickmathspace'>⁢</mo>
|
171
|
+
<mrow xref='U_NISTu9'>
|
172
|
+
<mi mathvariant='normal'>rad</mi>
|
173
|
+
</mrow>
|
174
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu9' dimensionURL='#D_L0'>
|
175
|
+
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
176
|
+
<UnitName xml:lang='en'>radian</UnitName>
|
177
|
+
<UnitSymbol type='HTML'>rad</UnitSymbol>
|
178
|
+
<UnitSymbol type='MathML'>
|
179
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
180
|
+
<mrow>
|
181
|
+
<mi mathvariant='normal'>rad</mi>
|
182
|
+
</mrow>
|
183
|
+
</math>
|
184
|
+
</UnitSymbol>
|
185
|
+
</Unit>
|
186
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='D_L0'>
|
187
|
+
<Length symbol='L' powerNumerator='0'/>
|
188
|
+
</Dimension>
|
189
|
+
<mo>+</mo>
|
190
|
+
<msup>
|
191
|
+
<mrow>
|
192
|
+
<mn>10</mn>
|
193
|
+
</mrow>
|
194
|
+
<mrow>
|
195
|
+
<mn>12</mn>
|
196
|
+
</mrow>
|
197
|
+
</msup>
|
198
|
+
<mo rspace='thickmathspace'>⁢</mo>
|
199
|
+
<mrow xref='U_NISTu31'>
|
200
|
+
<mi mathvariant='normal'>Hz</mi>
|
201
|
+
</mrow>
|
202
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu31' dimensionURL='#NISTd24'>
|
203
|
+
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
204
|
+
<UnitName xml:lang='en'>hertz</UnitName>
|
205
|
+
<UnitSymbol type='HTML'>Hz</UnitSymbol>
|
206
|
+
<UnitSymbol type='MathML'>
|
207
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
208
|
+
<mrow>
|
209
|
+
<mi mathvariant='normal'>Hz</mi>
|
210
|
+
</mrow>
|
211
|
+
</math>
|
212
|
+
</UnitSymbol>
|
213
|
+
</Unit>
|
214
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd24'>
|
215
|
+
<Time symbol='T' powerNumerator='-1'/>
|
216
|
+
</Dimension>
|
217
|
+
<Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq45' dimensionURL='#NISTd24' quantityType='base'>
|
218
|
+
<QuantityName xml:lang='en-US'>frequency</QuantityName>
|
219
|
+
</Quantity>
|
220
|
+
</math>
|
163
221
|
OUTPUT
|
164
222
|
end
|
165
223
|
|
224
|
+
it "does not insert space before operators" do
|
225
|
+
expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
|
226
|
+
8 "unitsml(kg)" cdot "unitsml(m)"
|
227
|
+
INPUT
|
228
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
229
|
+
<mn>8</mn>
|
230
|
+
<mo rspace='thickmathspace'>⁢</mo>
|
231
|
+
<mrow xref='U_NISTu2'>
|
232
|
+
<mi mathvariant='normal'>kg</mi>
|
233
|
+
</mrow>
|
234
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu2' dimensionURL='#NISTd2'>
|
235
|
+
<UnitSystem name='SI' type='SI_base' xml:lang='en-US'/>
|
236
|
+
<UnitName xml:lang='en'>kilogram</UnitName>
|
237
|
+
<UnitSymbol type='HTML'>kg</UnitSymbol>
|
238
|
+
<UnitSymbol type='MathML'>
|
239
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
240
|
+
<mrow>
|
241
|
+
<mi mathvariant='normal'>kg</mi>
|
242
|
+
</mrow>
|
243
|
+
</math>
|
244
|
+
</UnitSymbol>
|
245
|
+
<RootUnits>
|
246
|
+
<EnumeratedRootUnit unit='gram' prefix='k'/>
|
247
|
+
</RootUnits>
|
248
|
+
</Unit>
|
249
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
|
250
|
+
<PrefixName xml:lang='en'>kilo</PrefixName>
|
251
|
+
<PrefixSymbol type='ASCII'>k</PrefixSymbol>
|
252
|
+
<PrefixSymbol type='unicode'>k</PrefixSymbol>
|
253
|
+
<PrefixSymbol type='LaTeX'>k</PrefixSymbol>
|
254
|
+
<PrefixSymbol type='HTML'>k</PrefixSymbol>
|
255
|
+
</Prefix>
|
256
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd2'>
|
257
|
+
<Mass symbol='M' powerNumerator='1'/>
|
258
|
+
</Dimension>
|
259
|
+
<Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq2' dimensionURL='#NISTd2' quantityType='base'>
|
260
|
+
<QuantityName xml:lang='en-US'>mass</QuantityName>
|
261
|
+
</Quantity>
|
262
|
+
<mo>⋅</mo>
|
263
|
+
<mrow xref='U_NISTu1'>
|
264
|
+
<mi mathvariant='normal'>m</mi>
|
265
|
+
</mrow>
|
266
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu1' dimensionURL='#NISTd1'>
|
267
|
+
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
268
|
+
<UnitName xml:lang='en'>meter</UnitName>
|
269
|
+
<UnitSymbol type='HTML'>m</UnitSymbol>
|
270
|
+
<UnitSymbol type='MathML'>
|
271
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
272
|
+
<mrow>
|
273
|
+
<mi mathvariant='normal'>m</mi>
|
274
|
+
</mrow>
|
275
|
+
</math>
|
276
|
+
</UnitSymbol>
|
277
|
+
</Unit>
|
278
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd1'>
|
279
|
+
<Length symbol='L' powerNumerator='1'/>
|
280
|
+
</Dimension>
|
281
|
+
</math>
|
282
|
+
OUTPUT
|
283
|
+
end
|
284
|
+
|
166
285
|
it "deals with sqrt units" do
|
167
286
|
expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
|
168
287
|
1 "unitsml(sqrt(Hz))"
|
@@ -175,7 +294,7 @@ OUTPUT
|
|
175
294
|
<mi mathvariant='normal'>Hz</mi>
|
176
295
|
</msqrt>
|
177
296
|
</mrow>
|
178
|
-
<Unit xmlns='
|
297
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_Hz0.5' dimensionURL='#D_T-0.5'>
|
179
298
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
180
299
|
<UnitName xml:lang='en'>Hz^0.5</UnitName>
|
181
300
|
<UnitSymbol type='HTML'>√Hz</UnitSymbol>
|
@@ -189,7 +308,7 @@ OUTPUT
|
|
189
308
|
</math>
|
190
309
|
</UnitSymbol>
|
191
310
|
</Unit>
|
192
|
-
<Dimension xmlns='
|
311
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='D_T-0.5'>
|
193
312
|
<Time symbol='T' powerNumerator='-0.5'/>
|
194
313
|
</Dimension>
|
195
314
|
</math>
|
@@ -206,7 +325,7 @@ OUTPUT
|
|
206
325
|
<mrow xref='U_NISTu2'>
|
207
326
|
<mi mathvariant='normal'>kg</mi>
|
208
327
|
</mrow>
|
209
|
-
<Unit xmlns='
|
328
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu2' dimensionURL='#NISTd2'>
|
210
329
|
<UnitSystem name='SI' type='SI_base' xml:lang='en-US'/>
|
211
330
|
<UnitName xml:lang='en'>kilogram</UnitName>
|
212
331
|
<UnitSymbol type='HTML'>kg</UnitSymbol>
|
@@ -221,17 +340,17 @@ OUTPUT
|
|
221
340
|
<EnumeratedRootUnit unit='gram' prefix='k'/>
|
222
341
|
</RootUnits>
|
223
342
|
</Unit>
|
224
|
-
<Prefix xmlns='
|
343
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
|
225
344
|
<PrefixName xml:lang='en'>kilo</PrefixName>
|
226
345
|
<PrefixSymbol type='ASCII'>k</PrefixSymbol>
|
227
346
|
<PrefixSymbol type='unicode'>k</PrefixSymbol>
|
228
347
|
<PrefixSymbol type='LaTeX'>k</PrefixSymbol>
|
229
348
|
<PrefixSymbol type='HTML'>k</PrefixSymbol>
|
230
349
|
</Prefix>
|
231
|
-
<Dimension xmlns='
|
350
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd2'>
|
232
351
|
<Mass symbol='M' powerNumerator='1'/>
|
233
352
|
</Dimension>
|
234
|
-
<Quantity xmlns='
|
353
|
+
<Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq2' dimensionURL='#NISTd2' quantityType='base'>
|
235
354
|
<QuantityName xml:lang='en-US'>mass</QuantityName>
|
236
355
|
</Quantity>
|
237
356
|
<mo>+</mo>
|
@@ -240,7 +359,7 @@ OUTPUT
|
|
240
359
|
<mrow xref='U_NISTu27'>
|
241
360
|
<mi mathvariant='normal'>g</mi>
|
242
361
|
</mrow>
|
243
|
-
<Unit xmlns='
|
362
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu27' dimensionURL='#NISTd2'>
|
244
363
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
245
364
|
<UnitName xml:lang='en'>gram</UnitName>
|
246
365
|
<UnitSymbol type='HTML'>g</UnitSymbol>
|
@@ -266,7 +385,7 @@ OUTPUT
|
|
266
385
|
<mrow xref='U_NISTu284'>
|
267
386
|
<mi mathvariant='normal'>hp</mi>
|
268
387
|
</mrow>
|
269
|
-
<Unit xmlns='
|
388
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu284'>
|
270
389
|
<UnitSystem name='not_SI' type='not_SI' xml:lang='en-US'/>
|
271
390
|
<UnitName xml:lang='en'>horsepower</UnitName>
|
272
391
|
<UnitSymbol type='HTML'>hp</UnitSymbol>
|
@@ -278,12 +397,12 @@ OUTPUT
|
|
278
397
|
</math>
|
279
398
|
</UnitSymbol>
|
280
399
|
</Unit>
|
281
|
-
<Dimension xmlns='
|
400
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd16'>
|
282
401
|
<Length symbol='L' powerNumerator='2'/>
|
283
402
|
<Mass symbol='M' powerNumerator='1'/>
|
284
403
|
<Time symbol='T' powerNumerator='-3'/>
|
285
404
|
</Dimension>
|
286
|
-
<Quantity xmlns='
|
405
|
+
<Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq20' dimensionURL='#NISTd16' quantityType='base'>
|
287
406
|
<QuantityName xml:lang='en-US'>power</QuantityName>
|
288
407
|
</Quantity>
|
289
408
|
</math>
|
@@ -310,7 +429,7 @@ OUTPUT
|
|
310
429
|
</mrow>
|
311
430
|
</msup>
|
312
431
|
</mrow>
|
313
|
-
<Unit xmlns='
|
432
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
|
314
433
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
315
434
|
<UnitName xml:lang='en'>kg*s^-2</UnitName>
|
316
435
|
<UnitSymbol type='HTML'>
|
@@ -339,14 +458,14 @@ OUTPUT
|
|
339
458
|
<EnumeratedRootUnit unit='second' powerNumerator='-2'/>
|
340
459
|
</RootUnits>
|
341
460
|
</Unit>
|
342
|
-
<Prefix xmlns='
|
461
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
|
343
462
|
<PrefixName xml:lang='en'>kilo</PrefixName>
|
344
463
|
<PrefixSymbol type='ASCII'>k</PrefixSymbol>
|
345
464
|
<PrefixSymbol type='unicode'>k</PrefixSymbol>
|
346
465
|
<PrefixSymbol type='LaTeX'>k</PrefixSymbol>
|
347
466
|
<PrefixSymbol type='HTML'>k</PrefixSymbol>
|
348
467
|
</Prefix>
|
349
|
-
<Dimension xmlns='
|
468
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd37'>
|
350
469
|
<Mass symbol='M' powerNumerator='1'/>
|
351
470
|
<Time symbol='T' powerNumerator='-2'/>
|
352
471
|
</Dimension>
|
@@ -380,7 +499,7 @@ INPUT
|
|
380
499
|
<mrow xref='U_NISTu5'>
|
381
500
|
<mi mathvariant='normal'>°K</mi>
|
382
501
|
</mrow>
|
383
|
-
<Unit xmlns='
|
502
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu5' dimensionURL='#NISTd5'>
|
384
503
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
385
504
|
<UnitName xml:lang='en'>kelvin</UnitName>
|
386
505
|
<UnitSymbol type='HTML'>K</UnitSymbol>
|
@@ -392,10 +511,10 @@ INPUT
|
|
392
511
|
</math>
|
393
512
|
</UnitSymbol>
|
394
513
|
</Unit>
|
395
|
-
<Dimension xmlns='
|
514
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd5'>
|
396
515
|
<ThermodynamicTemperature symbol='Theta' powerNumerator='1'/>
|
397
516
|
</Dimension>
|
398
|
-
<Quantity xmlns='
|
517
|
+
<Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq5' dimensionURL='#NISTd5' quantityType='base'>
|
399
518
|
<QuantityName xml:lang='en-US'>thermodynamic temperature</QuantityName>
|
400
519
|
</Quantity>
|
401
520
|
<mo>+</mo>
|
@@ -418,7 +537,7 @@ INPUT
|
|
418
537
|
<mrow xref='U_NISTu362'>
|
419
538
|
<mi mathvariant='normal'>mbar</mi>
|
420
539
|
</mrow>
|
421
|
-
<Unit xmlns='
|
540
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu362'>
|
422
541
|
<UnitSystem name='not_SI' type='not_SI' xml:lang='en-US'/>
|
423
542
|
<UnitName xml:lang='en'>millibar</UnitName>
|
424
543
|
<UnitSymbol type='HTML'>mbar</UnitSymbol>
|
@@ -433,14 +552,14 @@ INPUT
|
|
433
552
|
<EnumeratedRootUnit unit='bar' prefix='m'/>
|
434
553
|
</RootUnits>
|
435
554
|
</Unit>
|
436
|
-
<Prefix xmlns='
|
555
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-3' xml:id='NISTp10_-3'>
|
437
556
|
<PrefixName xml:lang='en'>milli</PrefixName>
|
438
557
|
<PrefixSymbol type='ASCII'>m</PrefixSymbol>
|
439
558
|
<PrefixSymbol type='unicode'>m</PrefixSymbol>
|
440
559
|
<PrefixSymbol type='LaTeX'>m</PrefixSymbol>
|
441
560
|
<PrefixSymbol type='HTML'>m</PrefixSymbol>
|
442
561
|
</Prefix>
|
443
|
-
<Dimension xmlns='
|
562
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd14'>
|
444
563
|
<Length symbol='L' powerNumerator='-1'/>
|
445
564
|
<Mass symbol='M' powerNumerator='1'/>
|
446
565
|
<Time symbol='T' powerNumerator='-2'/>
|
@@ -457,17 +576,18 @@ OUTPUT
|
|
457
576
|
<mrow xref='NISTp10_-12'>
|
458
577
|
<mi mathvariant='normal'>p</mi>
|
459
578
|
</mrow>
|
460
|
-
<Prefix xmlns='
|
579
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-12' xml:id='NISTp10_-12'>
|
461
580
|
<PrefixName xml:lang='en'>pico</PrefixName>
|
462
581
|
<PrefixSymbol type='ASCII'>p</PrefixSymbol>
|
463
582
|
<PrefixSymbol type='unicode'>p</PrefixSymbol>
|
464
583
|
<PrefixSymbol type='LaTeX'>p</PrefixSymbol>
|
465
584
|
<PrefixSymbol type='HTML'>p</PrefixSymbol>
|
466
585
|
</Prefix>
|
586
|
+
<mo rspace='thickmathspace'>⁢</mo>
|
467
587
|
<mrow xref='NISTp10_1'>
|
468
588
|
<mi mathvariant='normal'>da</mi>
|
469
589
|
</mrow>
|
470
|
-
<Prefix xmlns='
|
590
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='1' xml:id='NISTp10_1'>
|
471
591
|
<PrefixName xml:lang='en'>deka</PrefixName>
|
472
592
|
<PrefixSymbol type='ASCII'>da</PrefixSymbol>
|
473
593
|
<PrefixSymbol type='unicode'>da</PrefixSymbol>
|
@@ -478,6 +598,53 @@ OUTPUT
|
|
478
598
|
OUTPUT
|
479
599
|
end
|
480
600
|
|
601
|
+
it "deals with HTML entities in UnitsDB" do
|
602
|
+
expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
|
603
|
+
"unitsml(u-)" + "unitsml(um)"
|
604
|
+
INPUT
|
605
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
606
|
+
<mrow xref='NISTp10_-6'>
|
607
|
+
<mi mathvariant='normal'>µ</mi>
|
608
|
+
</mrow>
|
609
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-6' xml:id='NISTp10_-6'>
|
610
|
+
<PrefixName xml:lang='en'>micro</PrefixName>
|
611
|
+
<PrefixSymbol type='ASCII'>u</PrefixSymbol>
|
612
|
+
<PrefixSymbol type='unicode'>μ</PrefixSymbol>
|
613
|
+
<PrefixSymbol type='LaTeX'>$mu$</PrefixSymbol>
|
614
|
+
<PrefixSymbol type='HTML'>µ</PrefixSymbol>
|
615
|
+
</Prefix>
|
616
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd2'>
|
617
|
+
<Mass symbol='M' powerNumerator='1'/>
|
618
|
+
</Dimension>
|
619
|
+
<Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq2' dimensionURL='#NISTd2' quantityType='base'>
|
620
|
+
<QuantityName xml:lang='en-US'>mass</QuantityName>
|
621
|
+
</Quantity>
|
622
|
+
<mo>+</mo>
|
623
|
+
<mrow xref='U_um'>
|
624
|
+
<mi mathvariant='normal'>µm</mi>
|
625
|
+
</mrow>
|
626
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_um' dimensionURL='#NISTd1'>
|
627
|
+
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
628
|
+
<UnitName xml:lang='en'>um</UnitName>
|
629
|
+
<UnitSymbol type='HTML'>um</UnitSymbol>
|
630
|
+
<UnitSymbol type='MathML'>
|
631
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
632
|
+
<mrow>
|
633
|
+
<mi mathvariant='normal'>µm</mi>
|
634
|
+
</mrow>
|
635
|
+
</math>
|
636
|
+
</UnitSymbol>
|
637
|
+
<RootUnits>
|
638
|
+
<EnumeratedRootUnit unit='meter' prefix='u'/>
|
639
|
+
</RootUnits>
|
640
|
+
</Unit>
|
641
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd1'>
|
642
|
+
<Length symbol='L' powerNumerator='1'/>
|
643
|
+
</Dimension>
|
644
|
+
</math>
|
645
|
+
OUTPUT
|
646
|
+
end
|
647
|
+
|
481
648
|
it "deals with units division" do
|
482
649
|
expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
|
483
650
|
9 "unitsml(A*C^3)" + 13 "unitsml(A/C^-3)"
|
@@ -497,7 +664,7 @@ INPUT
|
|
497
664
|
</mrow>
|
498
665
|
</msup>
|
499
666
|
</mrow>
|
500
|
-
<Unit xmlns='
|
667
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_A.C3' dimensionURL='#D_M3I4'>
|
501
668
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
502
669
|
<UnitName xml:lang='en'>A*C^3</UnitName>
|
503
670
|
<UnitSymbol type='HTML'>
|
@@ -525,7 +692,7 @@ INPUT
|
|
525
692
|
<EnumeratedRootUnit unit='coulomb' powerNumerator='3'/>
|
526
693
|
</RootUnits>
|
527
694
|
</Unit>
|
528
|
-
<Dimension xmlns='
|
695
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='D_M3I4'>
|
529
696
|
<Mass symbol='M' powerNumerator='3'/>
|
530
697
|
<ElectricCurrent symbol='I' powerNumerator='4'/>
|
531
698
|
</Dimension>
|
@@ -579,7 +746,7 @@ OUTPUT
|
|
579
746
|
</mrow>
|
580
747
|
</msup>
|
581
748
|
</mrow>
|
582
|
-
<Unit xmlns='
|
749
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_kg-2' dimensionURL='#D_M-2'>
|
583
750
|
<UnitSystem name='SI' type='SI_base' xml:lang='en-US'/>
|
584
751
|
<UnitName xml:lang='en'>kg^-2</UnitName>
|
585
752
|
<UnitSymbol type='HTML'>
|
@@ -605,14 +772,14 @@ OUTPUT
|
|
605
772
|
<EnumeratedRootUnit unit='gram' prefix='k' powerNumerator='-2'/>
|
606
773
|
</RootUnits>
|
607
774
|
</Unit>
|
608
|
-
<Prefix xmlns='
|
775
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
|
609
776
|
<PrefixName xml:lang='en'>kilo</PrefixName>
|
610
777
|
<PrefixSymbol type='ASCII'>k</PrefixSymbol>
|
611
778
|
<PrefixSymbol type='unicode'>k</PrefixSymbol>
|
612
779
|
<PrefixSymbol type='LaTeX'>k</PrefixSymbol>
|
613
780
|
<PrefixSymbol type='HTML'>k</PrefixSymbol>
|
614
781
|
</Prefix>
|
615
|
-
<Dimension xmlns='
|
782
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='D_M-2'>
|
616
783
|
<Mass symbol='M' powerNumerator='-2'/>
|
617
784
|
</Dimension>
|
618
785
|
</math>
|
@@ -647,7 +814,7 @@ OUTPUT
|
|
647
814
|
</mrow>
|
648
815
|
</msup>
|
649
816
|
</mrow>
|
650
|
-
<Unit xmlns='
|
817
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
|
651
818
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
652
819
|
<UnitName xml:lang='en'>kg*s^-2</UnitName>
|
653
820
|
<UnitSymbol type='HTML'>
|
@@ -676,14 +843,14 @@ OUTPUT
|
|
676
843
|
<EnumeratedRootUnit unit='second' powerNumerator='-2'/>
|
677
844
|
</RootUnits>
|
678
845
|
</Unit>
|
679
|
-
<Prefix xmlns='
|
846
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
|
680
847
|
<PrefixName xml:lang='en'>kilo</PrefixName>
|
681
848
|
<PrefixSymbol type='ASCII'>k</PrefixSymbol>
|
682
849
|
<PrefixSymbol type='unicode'>k</PrefixSymbol>
|
683
850
|
<PrefixSymbol type='LaTeX'>k</PrefixSymbol>
|
684
851
|
<PrefixSymbol type='HTML'>k</PrefixSymbol>
|
685
852
|
</Prefix>
|
686
|
-
<Dimension xmlns='
|
853
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd37'>
|
687
854
|
<Mass symbol='M' powerNumerator='1'/>
|
688
855
|
<Time symbol='T' powerNumerator='-2'/>
|
689
856
|
</Dimension>
|
@@ -708,7 +875,7 @@ OUTPUT
|
|
708
875
|
</mrow>
|
709
876
|
</msup>
|
710
877
|
</mrow>
|
711
|
-
<Unit xmlns='
|
878
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
|
712
879
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
713
880
|
<UnitName xml:lang='en'>kg*s^-2</UnitName>
|
714
881
|
<UnitSymbol type='HTML'>
|
@@ -737,14 +904,14 @@ OUTPUT
|
|
737
904
|
<EnumeratedRootUnit unit='second' powerNumerator='-2'/>
|
738
905
|
</RootUnits>
|
739
906
|
</Unit>
|
740
|
-
<Prefix xmlns='
|
907
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
|
741
908
|
<PrefixName xml:lang='en'>kilo</PrefixName>
|
742
909
|
<PrefixSymbol type='ASCII'>k</PrefixSymbol>
|
743
910
|
<PrefixSymbol type='unicode'>k</PrefixSymbol>
|
744
911
|
<PrefixSymbol type='LaTeX'>k</PrefixSymbol>
|
745
912
|
<PrefixSymbol type='HTML'>k</PrefixSymbol>
|
746
913
|
</Prefix>
|
747
|
-
<Dimension xmlns='
|
914
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd37'>
|
748
915
|
<Mass symbol='M' powerNumerator='1'/>
|
749
916
|
<Time symbol='T' powerNumerator='-2'/>
|
750
917
|
</Dimension>
|
@@ -769,7 +936,7 @@ OUTPUT
|
|
769
936
|
</mrow>
|
770
937
|
</msup>
|
771
938
|
</mrow>
|
772
|
-
<Unit xmlns='
|
939
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
|
773
940
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
774
941
|
<UnitName xml:lang='en'>kg*s^-2</UnitName>
|
775
942
|
<UnitSymbol type='HTML'>
|
@@ -798,14 +965,14 @@ OUTPUT
|
|
798
965
|
<EnumeratedRootUnit unit='second' powerNumerator='-2'/>
|
799
966
|
</RootUnits>
|
800
967
|
</Unit>
|
801
|
-
<Prefix xmlns='
|
968
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
|
802
969
|
<PrefixName xml:lang='en'>kilo</PrefixName>
|
803
970
|
<PrefixSymbol type='ASCII'>k</PrefixSymbol>
|
804
971
|
<PrefixSymbol type='unicode'>k</PrefixSymbol>
|
805
972
|
<PrefixSymbol type='LaTeX'>k</PrefixSymbol>
|
806
973
|
<PrefixSymbol type='HTML'>k</PrefixSymbol>
|
807
974
|
</Prefix>
|
808
|
-
<Dimension xmlns='
|
975
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd37'>
|
809
976
|
<Mass symbol='M' powerNumerator='1'/>
|
810
977
|
<Time symbol='T' powerNumerator='-2'/>
|
811
978
|
</Dimension>
|
@@ -833,7 +1000,7 @@ INPUT
|
|
833
1000
|
</mrow>
|
834
1001
|
</msup>
|
835
1002
|
</mrow>
|
836
|
-
<Unit xmlns='
|
1003
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_mW.cm-2'>
|
837
1004
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
838
1005
|
<UnitName xml:lang='en'>mW*cm^-2</UnitName>
|
839
1006
|
<UnitSymbol type='HTML'>
|
@@ -862,14 +1029,14 @@ INPUT
|
|
862
1029
|
<EnumeratedRootUnit unit='meter' prefix='c' powerNumerator='-2'/>
|
863
1030
|
</RootUnits>
|
864
1031
|
</Unit>
|
865
|
-
<Prefix xmlns='
|
1032
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-3' xml:id='NISTp10_-3'>
|
866
1033
|
<PrefixName xml:lang='en'>milli</PrefixName>
|
867
1034
|
<PrefixSymbol type='ASCII'>m</PrefixSymbol>
|
868
1035
|
<PrefixSymbol type='unicode'>m</PrefixSymbol>
|
869
1036
|
<PrefixSymbol type='LaTeX'>m</PrefixSymbol>
|
870
1037
|
<PrefixSymbol type='HTML'>m</PrefixSymbol>
|
871
1038
|
</Prefix>
|
872
|
-
<Prefix xmlns='
|
1039
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
|
873
1040
|
<PrefixName xml:lang='en'>centi</PrefixName>
|
874
1041
|
<PrefixSymbol type='ASCII'>c</PrefixSymbol>
|
875
1042
|
<PrefixSymbol type='unicode'>c</PrefixSymbol>
|
@@ -890,7 +1057,7 @@ INPUT
|
|
890
1057
|
<mrow xref='U_NISTu1'>
|
891
1058
|
<mi mathvariant='normal'>m</mi>
|
892
1059
|
</mrow>
|
893
|
-
<Unit xmlns='
|
1060
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu1' dimensionURL='#NISTd1'>
|
894
1061
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
895
1062
|
<UnitName xml:lang='en'>meter</UnitName>
|
896
1063
|
<UnitSymbol type='HTML'>m</UnitSymbol>
|
@@ -902,10 +1069,10 @@ INPUT
|
|
902
1069
|
</math>
|
903
1070
|
</UnitSymbol>
|
904
1071
|
</Unit>
|
905
|
-
<Dimension xmlns='
|
1072
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd1'>
|
906
1073
|
<Length symbol='L' powerNumerator='1'/>
|
907
1074
|
</Dimension>
|
908
|
-
<Quantity xmlns='
|
1075
|
+
<Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq103' dimensionURL='#NISTd1' quantityType='base'>
|
909
1076
|
<QuantityName xml:lang='en-US'>position vector</QuantityName>
|
910
1077
|
</Quantity>
|
911
1078
|
</math>
|
@@ -938,7 +1105,7 @@ INPUT
|
|
938
1105
|
</mrow>
|
939
1106
|
</msup>
|
940
1107
|
</mrow>
|
941
|
-
<Unit xmlns='
|
1108
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_cal_th.cm-2'>
|
942
1109
|
<UnitSystem name='not_SI' type='not_SI' xml:lang='en-US'/>
|
943
1110
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
944
1111
|
<UnitName xml:lang='en'>langley</UnitName>
|
@@ -977,7 +1144,7 @@ INPUT
|
|
977
1144
|
<EnumeratedRootUnit unit='meter' prefix='c' powerNumerator='-2'/>
|
978
1145
|
</RootUnits>
|
979
1146
|
</Unit>
|
980
|
-
<Prefix xmlns='
|
1147
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
|
981
1148
|
<PrefixName xml:lang='en'>centi</PrefixName>
|
982
1149
|
<PrefixSymbol type='ASCII'>c</PrefixSymbol>
|
983
1150
|
<PrefixSymbol type='unicode'>c</PrefixSymbol>
|
@@ -1001,7 +1168,7 @@ INPUT
|
|
1001
1168
|
<mi mathvariant='normal'>a</mi>
|
1002
1169
|
</math>
|
1003
1170
|
</mrow>
|
1004
|
-
<Unit xmlns='
|
1171
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu1' dimensionURL='#NISTd1'>
|
1005
1172
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
1006
1173
|
<UnitName xml:lang='en'>meter</UnitName>
|
1007
1174
|
<UnitSymbol type='HTML'>m</UnitSymbol>
|
@@ -1013,7 +1180,7 @@ INPUT
|
|
1013
1180
|
</math>
|
1014
1181
|
</UnitSymbol>
|
1015
1182
|
</Unit>
|
1016
|
-
<Dimension xmlns='
|
1183
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd1'>
|
1017
1184
|
<Length symbol='L' powerNumerator='1'/>
|
1018
1185
|
</Dimension>
|
1019
1186
|
<mo>+</mo>
|
@@ -1035,7 +1202,7 @@ INPUT
|
|
1035
1202
|
<mn>2</mn>
|
1036
1203
|
</math>
|
1037
1204
|
</mrow>
|
1038
|
-
<Unit xmlns='
|
1205
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_cm.s-2' dimensionURL='#NISTd28'>
|
1039
1206
|
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
1040
1207
|
<UnitName xml:lang='en'>cm*s^-2</UnitName>
|
1041
1208
|
<UnitSymbol type='HTML'>
|
@@ -1064,14 +1231,14 @@ INPUT
|
|
1064
1231
|
<EnumeratedRootUnit unit='second' powerNumerator='-2'/>
|
1065
1232
|
</RootUnits>
|
1066
1233
|
</Unit>
|
1067
|
-
<Prefix xmlns='
|
1234
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
|
1068
1235
|
<PrefixName xml:lang='en'>centi</PrefixName>
|
1069
1236
|
<PrefixSymbol type='ASCII'>c</PrefixSymbol>
|
1070
1237
|
<PrefixSymbol type='unicode'>c</PrefixSymbol>
|
1071
1238
|
<PrefixSymbol type='LaTeX'>c</PrefixSymbol>
|
1072
1239
|
<PrefixSymbol type='HTML'>c</PrefixSymbol>
|
1073
1240
|
</Prefix>
|
1074
|
-
<Dimension xmlns='
|
1241
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd28'>
|
1075
1242
|
<Length symbol='L' powerNumerator='1'/>
|
1076
1243
|
<Time symbol='T' powerNumerator='-2'/>
|
1077
1244
|
</Dimension>
|
@@ -1079,5 +1246,68 @@ INPUT
|
|
1079
1246
|
OUTPUT
|
1080
1247
|
end
|
1081
1248
|
|
1249
|
+
it "deals with multiplier input" do
|
1250
|
+
expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
|
1251
|
+
10 "unitsml(cm*s^-2, multiplier: xx)"
|
1252
|
+
INPUT
|
1253
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
1254
|
+
<mn>10</mn>
|
1255
|
+
<mo rspace='thickmathspace'>⁢</mo>
|
1256
|
+
<mrow xref='U_cm.s-2'>
|
1257
|
+
<mi mathvariant='normal'>cm</mi>
|
1258
|
+
<mo>xx</mo>
|
1259
|
+
<msup>
|
1260
|
+
<mrow>
|
1261
|
+
<mi mathvariant='normal'>s</mi>
|
1262
|
+
</mrow>
|
1263
|
+
<mrow>
|
1264
|
+
<mo>−</mo>
|
1265
|
+
<mn>2</mn>
|
1266
|
+
</mrow>
|
1267
|
+
</msup>
|
1268
|
+
</mrow>
|
1269
|
+
<Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_cm.s-2' dimensionURL='#NISTd28'>
|
1270
|
+
<UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
|
1271
|
+
<UnitName xml:lang='en'>cm*s^-2</UnitName>
|
1272
|
+
<UnitSymbol type='HTML'>
|
1273
|
+
cm·s
|
1274
|
+
<sup>−2</sup>
|
1275
|
+
</UnitSymbol>
|
1276
|
+
<UnitSymbol type='MathML'>
|
1277
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
1278
|
+
<mrow>
|
1279
|
+
<mi mathvariant='normal'>cm</mi>
|
1280
|
+
<mo>·</mo>
|
1281
|
+
<msup>
|
1282
|
+
<mrow>
|
1283
|
+
<mi mathvariant='normal'>s</mi>
|
1284
|
+
</mrow>
|
1285
|
+
<mrow>
|
1286
|
+
<mo>−</mo>
|
1287
|
+
<mn>2</mn>
|
1288
|
+
</mrow>
|
1289
|
+
</msup>
|
1290
|
+
</mrow>
|
1291
|
+
</math>
|
1292
|
+
</UnitSymbol>
|
1293
|
+
<RootUnits>
|
1294
|
+
<EnumeratedRootUnit unit='meter' prefix='c'/>
|
1295
|
+
<EnumeratedRootUnit unit='second' powerNumerator='-2'/>
|
1296
|
+
</RootUnits>
|
1297
|
+
</Unit>
|
1298
|
+
<Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
|
1299
|
+
<PrefixName xml:lang='en'>centi</PrefixName>
|
1300
|
+
<PrefixSymbol type='ASCII'>c</PrefixSymbol>
|
1301
|
+
<PrefixSymbol type='unicode'>c</PrefixSymbol>
|
1302
|
+
<PrefixSymbol type='LaTeX'>c</PrefixSymbol>
|
1303
|
+
<PrefixSymbol type='HTML'>c</PrefixSymbol>
|
1304
|
+
</Prefix>
|
1305
|
+
<Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd28'>
|
1306
|
+
<Length symbol='L' powerNumerator='1'/>
|
1307
|
+
<Time symbol='T' powerNumerator='-2'/>
|
1308
|
+
</Dimension>
|
1309
|
+
</math>
|
1310
|
+
OUTPUT
|
1311
|
+
end
|
1082
1312
|
|
1083
1313
|
end
|