plurimath 0.11.10 → 0.11.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 634327887a9f202817e10057ad12d4ee798212ffc0f6452a7cd720ac49637f4a
4
- data.tar.gz: 4a3ce4dd7d30039d99e7eb9fa4c22dcd14d03c97b63046e33434cdbf436eea86
3
+ metadata.gz: 4113e509a9cfc9298026571f3c9231f5ffba3ddf9f7307a66fd6335383c4a940
4
+ data.tar.gz: a51115633f6392f2940cb266823a77d660d701867f4c507f6a9e787b84da82b4
5
5
  SHA512:
6
- metadata.gz: 9b2c01fd19c8063e19d617f0f81cf7cbbd1de3a07a7d8c823393f2a946db0ac908241918b2c9cdb5b749cdf1eba85704ec8bc6618ec85997b78ebe2cdb53de81
7
- data.tar.gz: 601f9e1f0e59e2beda7968e2c8bd940ed96473d40dd75541ca862017cc27814c2c77ac9ab7a24c01ea5659359f6f6c0fc9cca384217e6a8c30d3180419104883
6
+ metadata.gz: 0450ed469724fc5117b04f24ee0fba4ba91810978943c3c3d08fe6db0ae98bcaa4e5a874a3c41ce05e9671f489941529c34ae6c35f1f5575dd033ddd99987ea2
7
+ data.tar.gz: 9f9a4dc4287cfda6c8f4128ab0e795c6772b1d12bfb3fa9ec56a0a88c4e9c45a7a8fd1941305fdf2cbf7b2a46cbcda879bf500196caa71bddae4ea837d668942
@@ -182,15 +182,14 @@ options:)
182
182
  options: options)
183
183
  end
184
184
 
185
- # Build Overset from source argument positions, not OMML child names,
186
- # so shared under/over functions keep the same format-neutral model.
187
- overset = Overset.new(first_value, parameter_two)
185
+ # Overset and Underset take script before base; OMML stores base in m:e.
186
+ overset = Overset.new(parameter_two, first_value)
188
187
  unless parameter_one
189
188
  return Array(overset.to_omml_without_math_tag(display_style,
190
189
  options: options))
191
190
  end
192
191
 
193
- underset = Underset.new(overset, parameter_one)
192
+ underset = Underset.new(parameter_one, overset)
194
193
  Array(underset.to_omml_without_math_tag(display_style,
195
194
  options: options))
196
195
  end
@@ -15,7 +15,14 @@ module Plurimath
15
15
  end
16
16
 
17
17
  def to_omml_without_math_tag(display_style, options:)
18
- omml_value(display_style, options: options)
18
+ value = parameter_one.is_a?(Array) ? parameter_one.compact : parameter_one
19
+ return [] if value.nil? || (value.is_a?(Array) && value.empty?)
20
+
21
+ nodes = Menclose.new("updiagonalstrike", value)
22
+ .to_omml_without_math_tag(display_style, options: options)
23
+ return [] if nodes.first.nodes.last.nodes.empty?
24
+
25
+ nodes
19
26
  end
20
27
 
21
28
  def to_unicodemath(options:)
@@ -23,7 +23,7 @@ module Plurimath
23
23
  return r_element("..", rpr_tag: false) unless parameter_one
24
24
 
25
25
  symbol = Symbols::Symbol.new("..")
26
- Overset.new(parameter_one, symbol).to_omml_without_math_tag(true,
26
+ Overset.new(symbol, parameter_one).to_omml_without_math_tag(true,
27
27
  options: options)
28
28
  end
29
29
 
@@ -39,7 +39,7 @@ module Plurimath
39
39
  acc_tag(display_style, options: options)
40
40
  else
41
41
  symbol = Symbols::Symbol.new(".")
42
- Overset.new(parameter_one, symbol).to_omml_without_math_tag(true,
42
+ Overset.new(symbol, parameter_one).to_omml_without_math_tag(true,
43
43
  options: options)
44
44
  end
45
45
  end
@@ -52,7 +52,7 @@ module Plurimath
52
52
  accent_tag(display_style, options: options)
53
53
  else
54
54
  symbol = Symbols::Symbol.new("̂") unless hide_function_name
55
- Overset.new(parameter_one, symbol).to_omml_without_math_tag(
55
+ Overset.new(symbol, parameter_one).to_omml_without_math_tag(
56
56
  display_style, options: options
57
57
  )
58
58
  end
@@ -66,7 +66,7 @@ module Plurimath
66
66
  parameter_one&.line_breaking(obj)
67
67
  if obj.value_exist?
68
68
  obj.update(
69
- Overset.new(Utility.filter_values(obj.value), nil),
69
+ Overset.new(nil, Utility.filter_values(obj.value)),
70
70
  )
71
71
  end
72
72
  end
@@ -48,7 +48,7 @@ module Plurimath
48
48
  acc_tag(display_style, options: options)
49
49
  else
50
50
  symbol = Symbols::Symbol.new("⏞")
51
- Overset.new(parameter_one, symbol).to_omml_without_math_tag(true,
51
+ Overset.new(symbol, parameter_one).to_omml_without_math_tag(true,
52
52
  options: options)
53
53
  end
54
54
  end
@@ -35,7 +35,7 @@ module Plurimath
35
35
  acc_tag(display_style, options: options)
36
36
  else
37
37
  symbol = Symbols::Symbol.new("\u20e1")
38
- Overset.new(parameter_one, symbol).to_omml_without_math_tag(true,
38
+ Overset.new(symbol, parameter_one).to_omml_without_math_tag(true,
39
39
  options: options)
40
40
  end
41
41
  end
@@ -8,8 +8,8 @@ module Plurimath
8
8
 
9
9
  FUNCTION = {
10
10
  name: "overset",
11
- first_value: "base",
12
- second_value: "supscript",
11
+ first_value: "supscript",
12
+ second_value: "base",
13
13
  }.freeze
14
14
 
15
15
  def initialize(
@@ -34,7 +34,7 @@ module Plurimath
34
34
 
35
35
  def to_omml_without_math_tag(display_style, options:)
36
36
  if !display_style
37
- power = Power.new(parameter_one, parameter_two)
37
+ power = Power.new(parameter_two, parameter_one)
38
38
  return power.to_omml_without_math_tag(display_style,
39
39
  options: options)
40
40
  end
@@ -46,12 +46,9 @@ module Plurimath
46
46
  limupp,
47
47
  [
48
48
  limupppr,
49
- # Overset preserves Plurimath's source argument order across
50
- # formats; OMML uses this mapping to avoid remapping fields during
51
- # MathML/UnicodeMath/OMML round-trips.
52
- omml_parameter(parameter_one, display_style, tag_name: "e",
49
+ omml_parameter(parameter_two, display_style, tag_name: "e",
53
50
  options: options),
54
- omml_parameter(parameter_two, display_style, tag_name: "lim",
51
+ omml_parameter(parameter_one, display_style, tag_name: "lim",
55
52
  options: options),
56
53
  ],
57
54
  )
@@ -241,15 +241,14 @@ options:)
241
241
  end
242
242
 
243
243
  def underover(display_style, options:)
244
- # Build Overset from source argument positions, not OMML child names,
245
- # so shared under/over functions keep the same format-neutral model.
246
- overset = Overset.new(parameter_one, parameter_three)
244
+ # Overset and Underset take script before base; OMML stores base in m:e.
245
+ overset = Overset.new(parameter_three, parameter_one)
247
246
  unless parameter_two
248
247
  return overset.to_omml_without_math_tag(display_style,
249
248
  options: options)
250
249
  end
251
250
 
252
- Underset.new(overset, parameter_two)&.to_omml_without_math_tag(
251
+ Underset.new(parameter_two, overset)&.to_omml_without_math_tag(
253
252
  display_style, options: options
254
253
  )
255
254
  end
@@ -28,7 +28,7 @@ module Plurimath
28
28
  acc_tag(display_style, options: options)
29
29
  else
30
30
  symbol = Symbols::Symbol.new("~")
31
- Overset.new(parameter_one, symbol).to_omml_without_math_tag(true,
31
+ Overset.new(symbol, parameter_one).to_omml_without_math_tag(true,
32
32
  options: options)
33
33
  end
34
34
  end
@@ -53,7 +53,7 @@ module Plurimath
53
53
  return r_element("⏟", rpr_tag: false) unless parameter_one
54
54
 
55
55
  symbol = Symbols::Symbol.new("⏟")
56
- Underset.new(parameter_one, symbol).to_omml_without_math_tag(true,
56
+ Underset.new(symbol, parameter_one).to_omml_without_math_tag(true,
57
57
  options: options)
58
58
  end
59
59
 
@@ -44,7 +44,7 @@ module Plurimath
44
44
  groupchr_tag(display_style, options: options)
45
45
  else
46
46
  symbol = Symbols::Symbol.new("̲")
47
- Underset.new(parameter_one, symbol).to_omml_without_math_tag(true,
47
+ Underset.new(symbol, parameter_one).to_omml_without_math_tag(true,
48
48
  options: options)
49
49
  end
50
50
  end
@@ -32,7 +32,7 @@ module Plurimath
32
32
 
33
33
  def to_omml_without_math_tag(display_style, options:)
34
34
  if !display_style
35
- base = Base.new(parameter_one, parameter_two)
35
+ base = Base.new(parameter_two, parameter_one)
36
36
  return base.to_omml_without_math_tag(display_style,
37
37
  options: options)
38
38
  end
@@ -48,9 +48,9 @@ module Plurimath
48
48
  limlow,
49
49
  [
50
50
  limlowpr,
51
- omml_parameter(parameter_one, display_style, tag_name: "e",
51
+ omml_parameter(parameter_two, display_style, tag_name: "e",
52
52
  options: options),
53
- omml_parameter(parameter_two, display_style, tag_name: "lim",
53
+ omml_parameter(parameter_one, display_style, tag_name: "lim",
54
54
  options: options),
55
55
  ],
56
56
  )
@@ -35,7 +35,7 @@ module Plurimath
35
35
  acc_tag(display_style, options: options)
36
36
  else
37
37
  symbol = Symbols::Symbol.new("→")
38
- Overset.new(parameter_one, symbol).to_omml_without_math_tag(true,
38
+ Overset.new(symbol, parameter_one).to_omml_without_math_tag(true,
39
39
  options: options)
40
40
  end
41
41
  end
@@ -27,7 +27,7 @@ module Plurimath
27
27
  end
28
28
 
29
29
  def to_mathml_without_math_tag(_, **)
30
- ox_element("mi") << "&#x2a00;"
30
+ ox_element("mo") << "&#x2a00;"
31
31
  end
32
32
 
33
33
  def to_omml_without_math_tag(_, **)
@@ -27,7 +27,7 @@ module Plurimath
27
27
  end
28
28
 
29
29
  def to_mathml_without_math_tag(_, **)
30
- ox_element("mi") << "&#x2a01;"
30
+ ox_element("mo") << "&#x2a01;"
31
31
  end
32
32
 
33
33
  def to_omml_without_math_tag(_, **)
@@ -27,7 +27,7 @@ module Plurimath
27
27
  end
28
28
 
29
29
  def to_mathml_without_math_tag(_, **)
30
- ox_element("mi") << "&#x2a02;"
30
+ ox_element("mo") << "&#x2a02;"
31
31
  end
32
32
 
33
33
  def to_omml_without_math_tag(_, **)
@@ -27,7 +27,7 @@ module Plurimath
27
27
  end
28
28
 
29
29
  def to_mathml_without_math_tag(_, **)
30
- ox_element("mi") << "&#x2a06;"
30
+ ox_element("mo") << "&#x2a06;"
31
31
  end
32
32
 
33
33
  def to_omml_without_math_tag(_, **)
@@ -27,7 +27,7 @@ module Plurimath
27
27
  end
28
28
 
29
29
  def to_mathml_without_math_tag(_, **)
30
- ox_element("mi") << "&#x2a04;"
30
+ ox_element("mo") << "&#x2a04;"
31
31
  end
32
32
 
33
33
  def to_omml_without_math_tag(_, **)
@@ -27,7 +27,7 @@ module Plurimath
27
27
  end
28
28
 
29
29
  def to_mathml_without_math_tag(_, **)
30
- ox_element("mi") << "&#x22c0;"
30
+ ox_element("mo") << "&#x22c0;"
31
31
  end
32
32
 
33
33
  def to_omml_without_math_tag(_, **)
@@ -27,7 +27,7 @@ module Plurimath
27
27
  end
28
28
 
29
29
  def to_mathml_without_math_tag(_, **)
30
- ox_element("mi") << "&#x2210;"
30
+ ox_element("mo") << "&#x2210;"
31
31
  end
32
32
 
33
33
  def to_omml_without_math_tag(_, **)
@@ -46,11 +46,16 @@ module Plurimath
46
46
  if value&.include?("&#x2147;")
47
47
  attributes[:intent] = Utility.html_entity_to_unicode(value)
48
48
  end
49
- attributes[:rspace] = @options[:rspace] if @options&.key?(:rspace)
50
- mi_tag = ox_element("mi", attributes: attributes)
51
- return mi_tag if ["{:", ":}"].include?(value)
52
-
53
- value ? mi_tag << value : mi_tag
49
+ # `rspace` is an operator attribute: MathML 4 allows it on `mo` (and
50
+ # `mpadded`), never on `mi`. A generic token that carries one must
51
+ # therefore serialize as `mo`, whatever produced it.
52
+ rspace = @options&.[](:rspace)
53
+ attributes[:rspace] = rspace unless rspace.nil?
54
+ tag_name = rspace.nil? ? "mi" : "mo"
55
+ token_tag = ox_element(tag_name, attributes: attributes)
56
+ return token_tag if ["{:", ":}"].include?(value)
57
+
58
+ value ? token_tag << value : token_tag
54
59
  end
55
60
 
56
61
  def to_latex(**)
@@ -173,18 +173,19 @@ module Plurimath
173
173
  )
174
174
  end
175
175
 
176
- # Keep OMML read and write using the same order: `m:e` is the first
177
- # value and `m:lim` is the second. Other formats, current or future,
178
- # should place those same values in the order their output needs.
176
+ # Overset and Underset take the script first and the base second;
177
+ # OMML stores the base in m:e and the script in m:lim.
178
+ # A named operator in m:lim is a script label, not an accent.
179
179
  def upper_limit_to_plurimath(node)
180
180
  base = omml_argument_value(node.e)
181
181
  limit = omml_argument_value(node.lim)
182
182
 
183
- if empty_unary_function?(limit)
183
+ if empty_unary_function?(limit) &&
184
+ !Mathml::Constants.named_function_word?(limit.class_name)
184
185
  limit.parameter_one = base
185
186
  limit
186
187
  else
187
- Math::Function::Overset.new(base, limit)
188
+ Math::Function::Overset.new(limit, base)
188
189
  end
189
190
  end
190
191
 
@@ -192,11 +193,12 @@ module Plurimath
192
193
  base = omml_argument_value(node.e)
193
194
  limit = omml_argument_value(node.lim)
194
195
 
195
- if empty_unary_function?(limit)
196
+ if empty_unary_function?(limit) &&
197
+ !Mathml::Constants.named_function_word?(limit.class_name)
196
198
  limit.parameter_one = base
197
199
  limit
198
200
  else
199
- Math::Function::Underset.new(base, limit)
201
+ Math::Function::Underset.new(limit, base)
200
202
  end
201
203
  end
202
204
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plurimath
4
- VERSION = "0.11.10"
4
+ VERSION = "0.11.12"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plurimath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.10
4
+ version: 0.11.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-10-19 00:00:00.000000000 Z
11
+ date: 2026-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bigdecimal