asciimath2unitsml 0.2.3 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,9 +42,10 @@ module Asciimath2UnitsML
42
42
  base
43
43
  end
44
44
 
45
- def mathmlsymbol(units, normalise)
45
+ def mathmlsymbol(units, normalise, multiplier = nil)
46
+ multiplier = multiplier ? "<mo>#{multiplier}</mo>" : @multiplier[:mathml]
46
47
  exp = units.map do |u|
47
- if u[:multiplier] then u[:multiplier] == "*" ? @multiplier[:mathml] : "<mo>#{u[:multiplier]}</mo>"
48
+ if u[:multiplier] then u[:multiplier] == "*" ? multiplier : "<mo>#{u[:multiplier]}</mo>"
48
49
  elsif u[:unit].nil? && u[:prefix]
49
50
  %(<mi mathvariant='normal'>#{htmlent(@prefixes[u[:prefix]].html)}</mi>)
50
51
  else
@@ -0,0 +1,57 @@
1
+ module Asciimath2UnitsML
2
+ class Conv
3
+ def validate_yaml(hash, path)
4
+ return hash if path == "../unitsdb/quantities.yaml"
5
+ return hash if path == "../unitsdb/dimensions.yaml"
6
+
7
+ hash.each_with_object({}) do |(k, v), m|
8
+ path == "../unitsdb/units.yaml" and validate_unit(v)
9
+ m = validate_symbols(m, v)
10
+ v[:unit_symbols]&.each { |s| validate_unit_symbol_cardinality(s, k) }
11
+ end
12
+ hash
13
+ end
14
+
15
+ def validate_unit(v)
16
+ if v[:quantity_reference]
17
+ v[:quantity_reference].is_a?(Array) or
18
+ raise StandardError.new "No quantity_reference array provided for unit: #{v}"
19
+ end
20
+ if v[:unit_name]
21
+ v[:unit_name].is_a?(Array) or
22
+ raise StandardError.new "No unit_name array provided for unit: #{v}"
23
+ end
24
+ end
25
+
26
+ def validate_symbols(m, v)
27
+ symbol = symbol_key(v)
28
+ !symbol.nil? or
29
+ raise StandardError.new "No symbol provided for unit: #{v}"
30
+ Array(symbol)&.each do |s|
31
+ m[s] && s != "1" and
32
+ raise StandardError.new "symbol #{s} is not unique in #{v}: "\
33
+ "already used for #{m[s]}"
34
+ m[s] = v
35
+ end
36
+ m
37
+ end
38
+
39
+ def validate_unit_symbol_cardinality(us, k)
40
+ return true if us.nil?
41
+
42
+ !us[:id].nil? && !us[:ascii].nil? && !us[:html].nil? &&
43
+ !us[:mathml].nil? && !us[:latex].nil? &&
44
+ !us[:unicode].nil? and return true
45
+ raise StandardError.new "malformed unit_symbol for #{k}: #{us}"
46
+ end
47
+
48
+ def symbol_key(v)
49
+ symbol = v[:unit_symbols]&.each_with_object([]) do |s, m|
50
+ m << (s["id"] || s[:id])
51
+ end || v.dig(:symbol, :ascii) || v[:symbol] #|| v[:short]
52
+ !symbol.nil? && v[:unit_symbols] && !symbol.is_a?(Array) and
53
+ symbol = [symbol]
54
+ symbol
55
+ end
56
+ end
57
+ end
@@ -1,3 +1,3 @@
1
1
  module Asciimath2UnitsML
2
- VERSION = '0.2.3'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
@@ -4340,8 +4340,8 @@
4340
4340
  unit_symbols:
4341
4341
  - id: "deg"
4342
4342
  ascii: "deg"
4343
- html: "&#186;"
4344
- mathml: "<mi mathvariant='normal'>&#186;</mi>"
4343
+ html: "&#176;"
4344
+ mathml: "<mi mathvariant='normal'>&#176;</mi>"
4345
4345
  latex: \ensuremath{\mathrm{^{\circ}}}
4346
4346
  unicode: "º"
4347
4347
  root_units:
data/spec/conv_spec.rb CHANGED
@@ -11,7 +11,7 @@ RSpec.describe Asciimath2UnitsML do
11
11
  <mo rspace='thickmathspace'>&#x2062;</mo>
12
12
  <mrow xref='U_mm.s-2'>
13
13
  <mi mathvariant='normal'>mm</mi>
14
- <mo>&#xB7;</mo>
14
+ <mo>&#x22C5;</mo>
15
15
  <msup>
16
16
  <mrow>
17
17
  <mi mathvariant='normal'>s</mi>
@@ -22,18 +22,18 @@ RSpec.describe Asciimath2UnitsML do
22
22
  </mrow>
23
23
  </msup>
24
24
  </mrow>
25
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_mm.s-2' dimensionURL='#NISTd28'>
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'>
29
- mm&#xB7;s
29
+ mm&#x22C5;s
30
30
  <sup>&#x2212;2</sup>
31
31
  </UnitSymbol>
32
32
  <UnitSymbol type='MathML'>
33
33
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
34
34
  <mrow>
35
35
  <mi mathvariant='normal'>mm</mi>
36
- <mo>&#xB7;</mo>
36
+ <mo>&#x22C5;</mo>
37
37
  <msup>
38
38
  <mrow>
39
39
  <mi mathvariant='normal'>s</mi>
@@ -51,14 +51,14 @@ RSpec.describe Asciimath2UnitsML do
51
51
  <EnumeratedRootUnit unit='second' powerNumerator='-2'/>
52
52
  </RootUnits>
53
53
  </Unit>
54
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='-3' xml:id='NISTp10_-3'>
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='http://unitsml.nist.gov/2005' xml:id='NISTd28'>
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
- it "deals with non-Ascii units and prefixes" do
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
@@ -77,7 +77,7 @@ RSpec.describe Asciimath2UnitsML do
77
77
  <mrow xref='U_um'>
78
78
  <mi mathvariant='normal'>&#xB5;m</mi>
79
79
  </mrow>
80
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_um' dimensionURL='#NISTd1'>
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>
@@ -92,77 +92,196 @@ RSpec.describe Asciimath2UnitsML do
92
92
  <EnumeratedRootUnit unit='meter' prefix='u'/>
93
93
  </RootUnits>
94
94
  </Unit>
95
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='-6' xml:id='NISTp10_-6'>
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'>&#x3BC;</PrefixSymbol>
99
99
  <PrefixSymbol type='LaTeX'>$mu$</PrefixSymbol>
100
100
  <PrefixSymbol type='HTML'>&#xB5;</PrefixSymbol>
101
101
  </Prefix>
102
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd1'>
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
- it "does not insert space before non-alphabetic units" do
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
- <mn>1</mn>
115
- <mo rspace='thickmathspace'>&#x2062;</mo>
116
- <mrow xref='U_NISTu5'>
117
- <mi mathvariant='normal'>&#xB0;K</mi>
118
- </mrow>
119
- <Unit xmlns='http://unitsml.nist.gov/2005' 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='http://unitsml.nist.gov/2005' xml:id='NISTd5'>
132
- <ThermodynamicTemperature symbol='Theta' powerNumerator='1'/>
133
- </Dimension>
134
- <Quantity xmlns='http://unitsml.nist.gov/2005' 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>&#x2062;</mo>
140
- <mrow xref='U_NISTu147'>
141
- <mi mathvariant='normal'>&#x2032;</mi>
142
- </mrow>
143
- <Unit xmlns='http://unitsml.nist.gov/2005' 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'>&#x2032;</UnitSymbol>
147
- <UnitSymbol type='MathML'>
148
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
149
- <mrow>
150
- <mi mathvariant='normal'>&#x2032;</mi>
151
- </mrow>
152
- </math>
153
- </UnitSymbol>
154
- </Unit>
155
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd9'>
156
- <PlaneAngle symbol='Phi' powerNumerator='1'/>
157
- </Dimension>
158
- <Quantity xmlns='http://unitsml.nist.gov/2005' 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
- </math>
114
+ <mn>1</mn>
115
+ <mo rspace='thickmathspace'>&#x2062;</mo>
116
+ <mrow xref='U_NISTu5'>
117
+ <mi mathvariant='normal'>&#xB0;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>&#x2062;</mo>
140
+ <mrow xref='U_NISTu147'>
141
+ <mi mathvariant='normal'>&#x2032;</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'>&#x2032;</UnitSymbol>
147
+ <UnitSymbol type='MathML'>
148
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
149
+ <mrow>
150
+ <mi mathvariant='normal'>&#x2032;</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>&#x3B8;</mi>
165
+ </mstyle>
166
+ <mo>=</mo>
167
+ <mi>s</mi>
168
+ <mo>/</mo>
169
+ <mi>r</mi>
170
+ <mo rspace='thickmathspace'>&#x2062;</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'>&#x2062;</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'>&#x2062;</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>&#x22C5;</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='http://unitsml.nist.gov/2005' xml:id='U_Hz0.5' dimensionURL='#D_T-0.5'>
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'>&#x221A;Hz</UnitSymbol>
@@ -189,7 +308,7 @@ OUTPUT
189
308
  </math>
190
309
  </UnitSymbol>
191
310
  </Unit>
192
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='D_T-0.5'>
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='http://unitsml.nist.gov/2005' xml:id='U_NISTu2' dimensionURL='#NISTd2'>
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='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
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='http://unitsml.nist.gov/2005' xml:id='NISTd2'>
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='http://unitsml.nist.gov/2005' xml:id='NISTq2' dimensionURL='#NISTd2' quantityType='base'>
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='http://unitsml.nist.gov/2005' xml:id='U_NISTu27' dimensionURL='#NISTd2'>
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='http://unitsml.nist.gov/2005' xml:id='U_NISTu284'>
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='http://unitsml.nist.gov/2005' xml:id='NISTd16'>
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='http://unitsml.nist.gov/2005' xml:id='NISTq20' dimensionURL='#NISTd16' quantityType='base'>
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>
@@ -299,7 +418,7 @@ OUTPUT
299
418
  <mo rspace='thickmathspace'>&#x2062;</mo>
300
419
  <mrow xref='U_kg.s-2'>
301
420
  <mi mathvariant='normal'>kg</mi>
302
- <mo>&#xB7;</mo>
421
+ <mo>&#x22C5;</mo>
303
422
  <msup>
304
423
  <mrow>
305
424
  <mi mathvariant='normal'>s</mi>
@@ -310,18 +429,18 @@ OUTPUT
310
429
  </mrow>
311
430
  </msup>
312
431
  </mrow>
313
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
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'>
317
- kg&#xB7;s
436
+ kg&#x22C5;s
318
437
  <sup>&#x2212;2</sup>
319
438
  </UnitSymbol>
320
439
  <UnitSymbol type='MathML'>
321
440
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
322
441
  <mrow>
323
442
  <mi mathvariant='normal'>kg</mi>
324
- <mo>&#xB7;</mo>
443
+ <mo>&#x22C5;</mo>
325
444
  <msup>
326
445
  <mrow>
327
446
  <mi mathvariant='normal'>s</mi>
@@ -339,14 +458,14 @@ OUTPUT
339
458
  <EnumeratedRootUnit unit='second' powerNumerator='-2'/>
340
459
  </RootUnits>
341
460
  </Unit>
342
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
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='http://unitsml.nist.gov/2005' xml:id='NISTd37'>
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>
@@ -355,7 +474,7 @@ OUTPUT
355
474
  <mo rspace='thickmathspace'>&#x2062;</mo>
356
475
  <mrow xref='U_kg.s-2'>
357
476
  <mi mathvariant='normal'>kg</mi>
358
- <mo>&#xB7;</mo>
477
+ <mo>&#x22C5;</mo>
359
478
  <msup>
360
479
  <mrow>
361
480
  <mi mathvariant='normal'>s</mi>
@@ -370,6 +489,78 @@ OUTPUT
370
489
  OUTPUT
371
490
  end
372
491
 
492
+ it "deals with parentheses" do
493
+ expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
494
+ 10 "unitsml(K/(kg*m))"
495
+ INPUT
496
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
497
+ <mn>10</mn>
498
+ <mo rspace='thickmathspace'>&#x2062;</mo>
499
+ <mrow xref='U_K/kg.m'>
500
+ <mi mathvariant='normal'>K</mi>
501
+ <mo>/</mo>
502
+ <mi mathvariant='normal'>kg</mi>
503
+ <mo>&#x22C5;</mo>
504
+ <mi mathvariant='normal'>m</mi>
505
+ </mrow>
506
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_K.kg-1.m-1' dimensionURL='#D_L-1M-1Theta'>
507
+ <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
508
+ <UnitName xml:lang='en'>K*kg^-1*m^-1</UnitName>
509
+ <UnitSymbol type='HTML'>
510
+ K&#x22C5;kg
511
+ <sup>&#x2212;1</sup>
512
+ &#x22C5;m
513
+ <sup>&#x2212;1</sup>
514
+ </UnitSymbol>
515
+ <UnitSymbol type='MathML'>
516
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
517
+ <mrow>
518
+ <mi mathvariant='normal'>K</mi>
519
+ <mo>&#x22C5;</mo>
520
+ <msup>
521
+ <mrow>
522
+ <mi mathvariant='normal'>kg</mi>
523
+ </mrow>
524
+ <mrow>
525
+ <mo>&#x2212;</mo>
526
+ <mn>1</mn>
527
+ </mrow>
528
+ </msup>
529
+ <mo>&#x22C5;</mo>
530
+ <msup>
531
+ <mrow>
532
+ <mi mathvariant='normal'>m</mi>
533
+ </mrow>
534
+ <mrow>
535
+ <mo>&#x2212;</mo>
536
+ <mn>1</mn>
537
+ </mrow>
538
+ </msup>
539
+ </mrow>
540
+ </math>
541
+ </UnitSymbol>
542
+ <RootUnits>
543
+ <EnumeratedRootUnit unit='kelvin'/>
544
+ <EnumeratedRootUnit unit='gram' prefix='k' powerNumerator='-1'/>
545
+ <EnumeratedRootUnit unit='meter' powerNumerator='-1'/>
546
+ </RootUnits>
547
+ </Unit>
548
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
549
+ <PrefixName xml:lang='en'>kilo</PrefixName>
550
+ <PrefixSymbol type='ASCII'>k</PrefixSymbol>
551
+ <PrefixSymbol type='unicode'>k</PrefixSymbol>
552
+ <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
553
+ <PrefixSymbol type='HTML'>k</PrefixSymbol>
554
+ </Prefix>
555
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='D_L-1M-1Theta'>
556
+ <Length symbol='L' powerNumerator='-1'/>
557
+ <Mass symbol='M' powerNumerator='-1'/>
558
+ <ThermodynamicTemperature symbol='Theta' powerNumerator='1'/>
559
+ </Dimension>
560
+ </math>
561
+ OUTPUT
562
+ end
563
+
373
564
  it "deals with notational variants" do
374
565
  expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
375
566
  9 "unitsml(degK)" + 10 "unitsml(K)"
@@ -380,7 +571,7 @@ INPUT
380
571
  <mrow xref='U_NISTu5'>
381
572
  <mi mathvariant='normal'>&#xB0;K</mi>
382
573
  </mrow>
383
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_NISTu5' dimensionURL='#NISTd5'>
574
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu5' dimensionURL='#NISTd5'>
384
575
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
385
576
  <UnitName xml:lang='en'>kelvin</UnitName>
386
577
  <UnitSymbol type='HTML'>K</UnitSymbol>
@@ -392,10 +583,10 @@ INPUT
392
583
  </math>
393
584
  </UnitSymbol>
394
585
  </Unit>
395
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd5'>
586
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd5'>
396
587
  <ThermodynamicTemperature symbol='Theta' powerNumerator='1'/>
397
588
  </Dimension>
398
- <Quantity xmlns='http://unitsml.nist.gov/2005' xml:id='NISTq5' dimensionURL='#NISTd5' quantityType='base'>
589
+ <Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq5' dimensionURL='#NISTd5' quantityType='base'>
399
590
  <QuantityName xml:lang='en-US'>thermodynamic temperature</QuantityName>
400
591
  </Quantity>
401
592
  <mo>+</mo>
@@ -418,7 +609,7 @@ INPUT
418
609
  <mrow xref='U_NISTu362'>
419
610
  <mi mathvariant='normal'>mbar</mi>
420
611
  </mrow>
421
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_NISTu362'>
612
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu362'>
422
613
  <UnitSystem name='not_SI' type='not_SI' xml:lang='en-US'/>
423
614
  <UnitName xml:lang='en'>millibar</UnitName>
424
615
  <UnitSymbol type='HTML'>mbar</UnitSymbol>
@@ -433,14 +624,14 @@ INPUT
433
624
  <EnumeratedRootUnit unit='bar' prefix='m'/>
434
625
  </RootUnits>
435
626
  </Unit>
436
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='-3' xml:id='NISTp10_-3'>
627
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-3' xml:id='NISTp10_-3'>
437
628
  <PrefixName xml:lang='en'>milli</PrefixName>
438
629
  <PrefixSymbol type='ASCII'>m</PrefixSymbol>
439
630
  <PrefixSymbol type='unicode'>m</PrefixSymbol>
440
631
  <PrefixSymbol type='LaTeX'>m</PrefixSymbol>
441
632
  <PrefixSymbol type='HTML'>m</PrefixSymbol>
442
633
  </Prefix>
443
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd14'>
634
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd14'>
444
635
  <Length symbol='L' powerNumerator='-1'/>
445
636
  <Mass symbol='M' powerNumerator='1'/>
446
637
  <Time symbol='T' powerNumerator='-2'/>
@@ -457,7 +648,7 @@ OUTPUT
457
648
  <mrow xref='NISTp10_-12'>
458
649
  <mi mathvariant='normal'>p</mi>
459
650
  </mrow>
460
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='-12' xml:id='NISTp10_-12'>
651
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-12' xml:id='NISTp10_-12'>
461
652
  <PrefixName xml:lang='en'>pico</PrefixName>
462
653
  <PrefixSymbol type='ASCII'>p</PrefixSymbol>
463
654
  <PrefixSymbol type='unicode'>p</PrefixSymbol>
@@ -468,7 +659,7 @@ OUTPUT
468
659
  <mrow xref='NISTp10_1'>
469
660
  <mi mathvariant='normal'>da</mi>
470
661
  </mrow>
471
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='1' xml:id='NISTp10_1'>
662
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='1' xml:id='NISTp10_1'>
472
663
  <PrefixName xml:lang='en'>deka</PrefixName>
473
664
  <PrefixSymbol type='ASCII'>da</PrefixSymbol>
474
665
  <PrefixSymbol type='unicode'>da</PrefixSymbol>
@@ -487,25 +678,24 @@ INPUT
487
678
  <mrow xref='NISTp10_-6'>
488
679
  <mi mathvariant='normal'>&#xB5;</mi>
489
680
  </mrow>
490
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='-6' xml:id='NISTp10_-6'>
681
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-6' xml:id='NISTp10_-6'>
491
682
  <PrefixName xml:lang='en'>micro</PrefixName>
492
683
  <PrefixSymbol type='ASCII'>u</PrefixSymbol>
493
684
  <PrefixSymbol type='unicode'>&#x3BC;</PrefixSymbol>
494
685
  <PrefixSymbol type='LaTeX'>$mu$</PrefixSymbol>
495
686
  <PrefixSymbol type='HTML'>&#xB5;</PrefixSymbol>
496
687
  </Prefix>
497
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd2'>
688
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd2'>
498
689
  <Mass symbol='M' powerNumerator='1'/>
499
690
  </Dimension>
500
- <Quantity xmlns='http://unitsml.nist.gov/2005' xml:id='NISTq2' dimensionURL='#NISTd2' quantityType='base'>
691
+ <Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq2' dimensionURL='#NISTd2' quantityType='base'>
501
692
  <QuantityName xml:lang='en-US'>mass</QuantityName>
502
693
  </Quantity>
503
694
  <mo>+</mo>
504
- <mo rspace='thickmathspace'>&#x2062;</mo>
505
695
  <mrow xref='U_um'>
506
696
  <mi mathvariant='normal'>&#xB5;m</mi>
507
697
  </mrow>
508
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_um' dimensionURL='#NISTd1'>
698
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_um' dimensionURL='#NISTd1'>
509
699
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
510
700
  <UnitName xml:lang='en'>um</UnitName>
511
701
  <UnitSymbol type='HTML'>um</UnitSymbol>
@@ -520,7 +710,7 @@ INPUT
520
710
  <EnumeratedRootUnit unit='meter' prefix='u'/>
521
711
  </RootUnits>
522
712
  </Unit>
523
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd1'>
713
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd1'>
524
714
  <Length symbol='L' powerNumerator='1'/>
525
715
  </Dimension>
526
716
  </math>
@@ -529,14 +719,14 @@ INPUT
529
719
 
530
720
  it "deals with units division" do
531
721
  expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
532
- 9 "unitsml(A*C^3)" + 13 "unitsml(A/C^-3)"
722
+ 9 "unitsml(A*C^3)" + 13 "unitsml(A/C^-3)" + 2 "unitsml(J/kg*K)"
533
723
  INPUT
534
724
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
535
725
  <mn>9</mn>
536
726
  <mo rspace='thickmathspace'>&#x2062;</mo>
537
727
  <mrow xref='U_A.C3'>
538
728
  <mi mathvariant='normal'>A</mi>
539
- <mo>&#xB7;</mo>
729
+ <mo>&#x22C5;</mo>
540
730
  <msup>
541
731
  <mrow>
542
732
  <mi mathvariant='normal'>C</mi>
@@ -546,18 +736,18 @@ INPUT
546
736
  </mrow>
547
737
  </msup>
548
738
  </mrow>
549
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_A.C3' dimensionURL='#D_M3I4'>
739
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_A.C3' dimensionURL='#D_M3I4'>
550
740
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
551
741
  <UnitName xml:lang='en'>A*C^3</UnitName>
552
742
  <UnitSymbol type='HTML'>
553
- A&#xB7;C
743
+ A&#x22C5;C
554
744
  <sup>3</sup>
555
745
  </UnitSymbol>
556
746
  <UnitSymbol type='MathML'>
557
747
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
558
748
  <mrow>
559
749
  <mi mathvariant='normal'>A</mi>
560
- <mo>&#xB7;</mo>
750
+ <mo>&#x22C5;</mo>
561
751
  <msup>
562
752
  <mrow>
563
753
  <mi mathvariant='normal'>C</mi>
@@ -574,7 +764,7 @@ INPUT
574
764
  <EnumeratedRootUnit unit='coulomb' powerNumerator='3'/>
575
765
  </RootUnits>
576
766
  </Unit>
577
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='D_M3I4'>
767
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='D_M3I4'>
578
768
  <Mass symbol='M' powerNumerator='3'/>
579
769
  <ElectricCurrent symbol='I' powerNumerator='4'/>
580
770
  </Dimension>
@@ -594,6 +784,76 @@ INPUT
594
784
  </mrow>
595
785
  </msup>
596
786
  </mrow>
787
+ <mo>+</mo>
788
+ <mn>2</mn>
789
+ <mo rspace='thickmathspace'>&#x2062;</mo>
790
+ <mrow xref='U_J/kg.K'>
791
+ <mi mathvariant='normal'>J</mi>
792
+ <mo>/</mo>
793
+ <mi mathvariant='normal'>kg</mi>
794
+ <mo>&#x22C5;</mo>
795
+ <mi mathvariant='normal'>K</mi>
796
+ </mrow>
797
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu13.u27p10_3e-1/1.u5e-1/1' dimensionURL='#D_L2M0T-2Theta-1'>
798
+ <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
799
+ <UnitName xml:lang='en'>joule per kilogram kelvin</UnitName>
800
+ <UnitSymbol type='HTML'>
801
+ J&#x22C5;kg
802
+ <sup>&#x2212;1</sup>
803
+ &#x22C5;K
804
+ <sup>&#x2212;1</sup>
805
+ </UnitSymbol>
806
+ <UnitSymbol type='MathML'>
807
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
808
+ <mrow>
809
+ <mi mathvariant='normal'>J</mi>
810
+ <mo>&#x22C5;</mo>
811
+ <msup>
812
+ <mrow>
813
+ <mi mathvariant='normal'>kg</mi>
814
+ </mrow>
815
+ <mrow>
816
+ <mo>&#x2212;</mo>
817
+ <mn>1</mn>
818
+ </mrow>
819
+ </msup>
820
+ <mo>&#x22C5;</mo>
821
+ <msup>
822
+ <mrow>
823
+ <mi mathvariant='normal'>K</mi>
824
+ </mrow>
825
+ <mrow>
826
+ <mo>&#x2212;</mo>
827
+ <mn>1</mn>
828
+ </mrow>
829
+ </msup>
830
+ </mrow>
831
+ </math>
832
+ </UnitSymbol>
833
+ <RootUnits>
834
+ <EnumeratedRootUnit unit='joule'/>
835
+ <EnumeratedRootUnit unit='gram' prefix='k' powerNumerator='-1'/>
836
+ <EnumeratedRootUnit unit='kelvin' powerNumerator='-1'/>
837
+ </RootUnits>
838
+ </Unit>
839
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
840
+ <PrefixName xml:lang='en'>kilo</PrefixName>
841
+ <PrefixSymbol type='ASCII'>k</PrefixSymbol>
842
+ <PrefixSymbol type='unicode'>k</PrefixSymbol>
843
+ <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
844
+ <PrefixSymbol type='HTML'>k</PrefixSymbol>
845
+ </Prefix>
846
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd40'>
847
+ <Length symbol='L' powerNumerator='2'/>
848
+ <Time symbol='T' powerNumerator='-2'/>
849
+ <ThermodynamicTemperature symbol='Theta' powerNumerator='-1'/>
850
+ </Dimension>
851
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='D_L2M0T-2Theta-1'>
852
+ <Length symbol='L' powerNumerator='2'/>
853
+ <Mass symbol='M' powerNumerator='0'/>
854
+ <Time symbol='T' powerNumerator='-2'/>
855
+ <ThermodynamicTemperature symbol='Theta' powerNumerator='-1'/>
856
+ </Dimension>
597
857
  </math>
598
858
  OUTPUT
599
859
  end
@@ -628,7 +888,7 @@ OUTPUT
628
888
  </mrow>
629
889
  </msup>
630
890
  </mrow>
631
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_kg-2' dimensionURL='#D_M-2'>
891
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_kg-2' dimensionURL='#D_M-2'>
632
892
  <UnitSystem name='SI' type='SI_base' xml:lang='en-US'/>
633
893
  <UnitName xml:lang='en'>kg^-2</UnitName>
634
894
  <UnitSymbol type='HTML'>
@@ -654,14 +914,14 @@ OUTPUT
654
914
  <EnumeratedRootUnit unit='gram' prefix='k' powerNumerator='-2'/>
655
915
  </RootUnits>
656
916
  </Unit>
657
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
917
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
658
918
  <PrefixName xml:lang='en'>kilo</PrefixName>
659
919
  <PrefixSymbol type='ASCII'>k</PrefixSymbol>
660
920
  <PrefixSymbol type='unicode'>k</PrefixSymbol>
661
921
  <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
662
922
  <PrefixSymbol type='HTML'>k</PrefixSymbol>
663
923
  </Prefix>
664
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='D_M-2'>
924
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='D_M-2'>
665
925
  <Mass symbol='M' powerNumerator='-2'/>
666
926
  </Dimension>
667
927
  </math>
@@ -696,7 +956,7 @@ OUTPUT
696
956
  </mrow>
697
957
  </msup>
698
958
  </mrow>
699
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
959
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
700
960
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
701
961
  <UnitName xml:lang='en'>kg*s^-2</UnitName>
702
962
  <UnitSymbol type='HTML'>
@@ -725,14 +985,14 @@ OUTPUT
725
985
  <EnumeratedRootUnit unit='second' powerNumerator='-2'/>
726
986
  </RootUnits>
727
987
  </Unit>
728
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
988
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
729
989
  <PrefixName xml:lang='en'>kilo</PrefixName>
730
990
  <PrefixSymbol type='ASCII'>k</PrefixSymbol>
731
991
  <PrefixSymbol type='unicode'>k</PrefixSymbol>
732
992
  <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
733
993
  <PrefixSymbol type='HTML'>k</PrefixSymbol>
734
994
  </Prefix>
735
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd37'>
995
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd37'>
736
996
  <Mass symbol='M' powerNumerator='1'/>
737
997
  <Time symbol='T' powerNumerator='-2'/>
738
998
  </Dimension>
@@ -757,7 +1017,7 @@ OUTPUT
757
1017
  </mrow>
758
1018
  </msup>
759
1019
  </mrow>
760
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
1020
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
761
1021
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
762
1022
  <UnitName xml:lang='en'>kg*s^-2</UnitName>
763
1023
  <UnitSymbol type='HTML'>
@@ -786,14 +1046,14 @@ OUTPUT
786
1046
  <EnumeratedRootUnit unit='second' powerNumerator='-2'/>
787
1047
  </RootUnits>
788
1048
  </Unit>
789
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
1049
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
790
1050
  <PrefixName xml:lang='en'>kilo</PrefixName>
791
1051
  <PrefixSymbol type='ASCII'>k</PrefixSymbol>
792
1052
  <PrefixSymbol type='unicode'>k</PrefixSymbol>
793
1053
  <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
794
1054
  <PrefixSymbol type='HTML'>k</PrefixSymbol>
795
1055
  </Prefix>
796
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd37'>
1056
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd37'>
797
1057
  <Mass symbol='M' powerNumerator='1'/>
798
1058
  <Time symbol='T' powerNumerator='-2'/>
799
1059
  </Dimension>
@@ -818,7 +1078,7 @@ OUTPUT
818
1078
  </mrow>
819
1079
  </msup>
820
1080
  </mrow>
821
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
1081
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_kg.s-2' dimensionURL='#NISTd37'>
822
1082
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
823
1083
  <UnitName xml:lang='en'>kg*s^-2</UnitName>
824
1084
  <UnitSymbol type='HTML'>
@@ -847,14 +1107,14 @@ OUTPUT
847
1107
  <EnumeratedRootUnit unit='second' powerNumerator='-2'/>
848
1108
  </RootUnits>
849
1109
  </Unit>
850
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
1110
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='3' xml:id='NISTp10_3'>
851
1111
  <PrefixName xml:lang='en'>kilo</PrefixName>
852
1112
  <PrefixSymbol type='ASCII'>k</PrefixSymbol>
853
1113
  <PrefixSymbol type='unicode'>k</PrefixSymbol>
854
1114
  <PrefixSymbol type='LaTeX'>k</PrefixSymbol>
855
1115
  <PrefixSymbol type='HTML'>k</PrefixSymbol>
856
1116
  </Prefix>
857
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd37'>
1117
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd37'>
858
1118
  <Mass symbol='M' powerNumerator='1'/>
859
1119
  <Time symbol='T' powerNumerator='-2'/>
860
1120
  </Dimension>
@@ -871,7 +1131,7 @@ INPUT
871
1131
  <mo rspace='thickmathspace'>&#x2062;</mo>
872
1132
  <mrow xref='U_mW.cm-2'>
873
1133
  <mi mathvariant='normal'>mW</mi>
874
- <mo>&#xB7;</mo>
1134
+ <mo>&#x22C5;</mo>
875
1135
  <msup>
876
1136
  <mrow>
877
1137
  <mi mathvariant='normal'>cm</mi>
@@ -882,18 +1142,18 @@ INPUT
882
1142
  </mrow>
883
1143
  </msup>
884
1144
  </mrow>
885
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_mW.cm-2'>
1145
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_mW.cm-2'>
886
1146
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
887
1147
  <UnitName xml:lang='en'>mW*cm^-2</UnitName>
888
1148
  <UnitSymbol type='HTML'>
889
- mW&#xB7;cm
1149
+ mW&#x22C5;cm
890
1150
  <sup>&#x2212;2</sup>
891
1151
  </UnitSymbol>
892
1152
  <UnitSymbol type='MathML'>
893
1153
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
894
1154
  <mrow>
895
1155
  <mi mathvariant='normal'>mW</mi>
896
- <mo>&#xB7;</mo>
1156
+ <mo>&#x22C5;</mo>
897
1157
  <msup>
898
1158
  <mrow>
899
1159
  <mi mathvariant='normal'>cm</mi>
@@ -911,14 +1171,14 @@ INPUT
911
1171
  <EnumeratedRootUnit unit='meter' prefix='c' powerNumerator='-2'/>
912
1172
  </RootUnits>
913
1173
  </Unit>
914
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='-3' xml:id='NISTp10_-3'>
1174
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-3' xml:id='NISTp10_-3'>
915
1175
  <PrefixName xml:lang='en'>milli</PrefixName>
916
1176
  <PrefixSymbol type='ASCII'>m</PrefixSymbol>
917
1177
  <PrefixSymbol type='unicode'>m</PrefixSymbol>
918
1178
  <PrefixSymbol type='LaTeX'>m</PrefixSymbol>
919
1179
  <PrefixSymbol type='HTML'>m</PrefixSymbol>
920
1180
  </Prefix>
921
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
1181
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
922
1182
  <PrefixName xml:lang='en'>centi</PrefixName>
923
1183
  <PrefixSymbol type='ASCII'>c</PrefixSymbol>
924
1184
  <PrefixSymbol type='unicode'>c</PrefixSymbol>
@@ -939,7 +1199,7 @@ INPUT
939
1199
  <mrow xref='U_NISTu1'>
940
1200
  <mi mathvariant='normal'>m</mi>
941
1201
  </mrow>
942
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_NISTu1' dimensionURL='#NISTd1'>
1202
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu1' dimensionURL='#NISTd1'>
943
1203
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
944
1204
  <UnitName xml:lang='en'>meter</UnitName>
945
1205
  <UnitSymbol type='HTML'>m</UnitSymbol>
@@ -951,10 +1211,10 @@ INPUT
951
1211
  </math>
952
1212
  </UnitSymbol>
953
1213
  </Unit>
954
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd1'>
1214
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd1'>
955
1215
  <Length symbol='L' powerNumerator='1'/>
956
1216
  </Dimension>
957
- <Quantity xmlns='http://unitsml.nist.gov/2005' xml:id='NISTq103' dimensionURL='#NISTd1' quantityType='base'>
1217
+ <Quantity xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTq103' dimensionURL='#NISTd1' quantityType='base'>
958
1218
  <QuantityName xml:lang='en-US'>position vector</QuantityName>
959
1219
  </Quantity>
960
1220
  </math>
@@ -987,14 +1247,14 @@ INPUT
987
1247
  </mrow>
988
1248
  </msup>
989
1249
  </mrow>
990
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_cal_th.cm-2'>
1250
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_cal_th.cm-2'>
991
1251
  <UnitSystem name='not_SI' type='not_SI' xml:lang='en-US'/>
992
1252
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
993
1253
  <UnitName xml:lang='en'>langley</UnitName>
994
1254
  <UnitSymbol type='HTML'>
995
1255
  cal
996
1256
  <sub>th</sub>
997
- &#xB7;cm
1257
+ &#x22C5;cm
998
1258
  <sup>&#x2212;2</sup>
999
1259
  </UnitSymbol>
1000
1260
  <UnitSymbol type='MathML'>
@@ -1008,7 +1268,7 @@ INPUT
1008
1268
  <mi mathvariant='normal'>th</mi>
1009
1269
  </mrow>
1010
1270
  </msub>
1011
- <mo>&#xB7;</mo>
1271
+ <mo>&#x22C5;</mo>
1012
1272
  <msup>
1013
1273
  <mrow>
1014
1274
  <mi mathvariant='normal'>cm</mi>
@@ -1026,7 +1286,7 @@ INPUT
1026
1286
  <EnumeratedRootUnit unit='meter' prefix='c' powerNumerator='-2'/>
1027
1287
  </RootUnits>
1028
1288
  </Unit>
1029
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
1289
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
1030
1290
  <PrefixName xml:lang='en'>centi</PrefixName>
1031
1291
  <PrefixSymbol type='ASCII'>c</PrefixSymbol>
1032
1292
  <PrefixSymbol type='unicode'>c</PrefixSymbol>
@@ -1050,7 +1310,7 @@ INPUT
1050
1310
  <mi mathvariant='normal'>a</mi>
1051
1311
  </math>
1052
1312
  </mrow>
1053
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_NISTu1' dimensionURL='#NISTd1'>
1313
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_NISTu1' dimensionURL='#NISTd1'>
1054
1314
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
1055
1315
  <UnitName xml:lang='en'>meter</UnitName>
1056
1316
  <UnitSymbol type='HTML'>m</UnitSymbol>
@@ -1062,7 +1322,7 @@ INPUT
1062
1322
  </math>
1063
1323
  </UnitSymbol>
1064
1324
  </Unit>
1065
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd1'>
1325
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd1'>
1066
1326
  <Length symbol='L' powerNumerator='1'/>
1067
1327
  </Dimension>
1068
1328
  <mo>+</mo>
@@ -1084,18 +1344,18 @@ INPUT
1084
1344
  <mn>2</mn>
1085
1345
  </math>
1086
1346
  </mrow>
1087
- <Unit xmlns='http://unitsml.nist.gov/2005' xml:id='U_cm.s-2' dimensionURL='#NISTd28'>
1347
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_cm.s-2' dimensionURL='#NISTd28'>
1088
1348
  <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
1089
1349
  <UnitName xml:lang='en'>cm*s^-2</UnitName>
1090
1350
  <UnitSymbol type='HTML'>
1091
- cm&#xB7;s
1351
+ cm&#x22C5;s
1092
1352
  <sup>&#x2212;2</sup>
1093
1353
  </UnitSymbol>
1094
1354
  <UnitSymbol type='MathML'>
1095
1355
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
1096
1356
  <mrow>
1097
1357
  <mi mathvariant='normal'>cm</mi>
1098
- <mo>&#xB7;</mo>
1358
+ <mo>&#x22C5;</mo>
1099
1359
  <msup>
1100
1360
  <mrow>
1101
1361
  <mi mathvariant='normal'>s</mi>
@@ -1113,14 +1373,14 @@ INPUT
1113
1373
  <EnumeratedRootUnit unit='second' powerNumerator='-2'/>
1114
1374
  </RootUnits>
1115
1375
  </Unit>
1116
- <Prefix xmlns='http://unitsml.nist.gov/2005' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
1376
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
1117
1377
  <PrefixName xml:lang='en'>centi</PrefixName>
1118
1378
  <PrefixSymbol type='ASCII'>c</PrefixSymbol>
1119
1379
  <PrefixSymbol type='unicode'>c</PrefixSymbol>
1120
1380
  <PrefixSymbol type='LaTeX'>c</PrefixSymbol>
1121
1381
  <PrefixSymbol type='HTML'>c</PrefixSymbol>
1122
1382
  </Prefix>
1123
- <Dimension xmlns='http://unitsml.nist.gov/2005' xml:id='NISTd28'>
1383
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd28'>
1124
1384
  <Length symbol='L' powerNumerator='1'/>
1125
1385
  <Time symbol='T' powerNumerator='-2'/>
1126
1386
  </Dimension>
@@ -1128,5 +1388,68 @@ INPUT
1128
1388
  OUTPUT
1129
1389
  end
1130
1390
 
1391
+ it "deals with multiplier input" do
1392
+ expect(xmlpp(Asciimath2UnitsML::Conv.new().Asciimath2UnitsML(<<~INPUT))).to be_equivalent_to xmlpp(<<~OUTPUT)
1393
+ 10 "unitsml(cm*s^-2, multiplier: xx)"
1394
+ INPUT
1395
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1396
+ <mn>10</mn>
1397
+ <mo rspace='thickmathspace'>&#x2062;</mo>
1398
+ <mrow xref='U_cm.s-2'>
1399
+ <mi mathvariant='normal'>cm</mi>
1400
+ <mo>xx</mo>
1401
+ <msup>
1402
+ <mrow>
1403
+ <mi mathvariant='normal'>s</mi>
1404
+ </mrow>
1405
+ <mrow>
1406
+ <mo>&#x2212;</mo>
1407
+ <mn>2</mn>
1408
+ </mrow>
1409
+ </msup>
1410
+ </mrow>
1411
+ <Unit xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='U_cm.s-2' dimensionURL='#NISTd28'>
1412
+ <UnitSystem name='SI' type='SI_derived' xml:lang='en-US'/>
1413
+ <UnitName xml:lang='en'>cm*s^-2</UnitName>
1414
+ <UnitSymbol type='HTML'>
1415
+ cm&#x22C5;s
1416
+ <sup>&#x2212;2</sup>
1417
+ </UnitSymbol>
1418
+ <UnitSymbol type='MathML'>
1419
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1420
+ <mrow>
1421
+ <mi mathvariant='normal'>cm</mi>
1422
+ <mo>&#x22C5;</mo>
1423
+ <msup>
1424
+ <mrow>
1425
+ <mi mathvariant='normal'>s</mi>
1426
+ </mrow>
1427
+ <mrow>
1428
+ <mo>&#x2212;</mo>
1429
+ <mn>2</mn>
1430
+ </mrow>
1431
+ </msup>
1432
+ </mrow>
1433
+ </math>
1434
+ </UnitSymbol>
1435
+ <RootUnits>
1436
+ <EnumeratedRootUnit unit='meter' prefix='c'/>
1437
+ <EnumeratedRootUnit unit='second' powerNumerator='-2'/>
1438
+ </RootUnits>
1439
+ </Unit>
1440
+ <Prefix xmlns='https://schema.unitsml.org/unitsml/1.0' prefixBase='10' prefixPower='-2' xml:id='NISTp10_-2'>
1441
+ <PrefixName xml:lang='en'>centi</PrefixName>
1442
+ <PrefixSymbol type='ASCII'>c</PrefixSymbol>
1443
+ <PrefixSymbol type='unicode'>c</PrefixSymbol>
1444
+ <PrefixSymbol type='LaTeX'>c</PrefixSymbol>
1445
+ <PrefixSymbol type='HTML'>c</PrefixSymbol>
1446
+ </Prefix>
1447
+ <Dimension xmlns='https://schema.unitsml.org/unitsml/1.0' xml:id='NISTd28'>
1448
+ <Length symbol='L' powerNumerator='1'/>
1449
+ <Time symbol='T' powerNumerator='-2'/>
1450
+ </Dimension>
1451
+ </math>
1452
+ OUTPUT
1453
+ end
1131
1454
 
1132
1455
  end