plurimath 0.8.16 → 0.8.18

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.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/gen_docs.yml +10 -8
  3. data/Gemfile +1 -1
  4. data/README.adoc +4 -0
  5. data/Rakefile +55 -8
  6. data/intent_supported_classes.adoc +82 -0
  7. data/lib/plurimath/asciimath/parse.rb +1 -0
  8. data/lib/plurimath/asciimath/transform.rb +12 -0
  9. data/lib/plurimath/formatter/number_formatter.rb +6 -6
  10. data/lib/plurimath/formatter/numeric_formatter.rb +5 -2
  11. data/lib/plurimath/formatter/standard.rb +2 -0
  12. data/lib/plurimath/math/core.rb +65 -6
  13. data/lib/plurimath/math/formula/mrow.rb +193 -0
  14. data/lib/plurimath/math/formula/mstyle.rb +17 -0
  15. data/lib/plurimath/math/formula.rb +317 -7
  16. data/lib/plurimath/math/function/abs.rb +5 -1
  17. data/lib/plurimath/math/function/base.rb +4 -0
  18. data/lib/plurimath/math/function/color.rb +17 -4
  19. data/lib/plurimath/math/function/fenced.rb +238 -7
  20. data/lib/plurimath/math/function/frac.rb +12 -1
  21. data/lib/plurimath/math/function/inf.rb +5 -1
  22. data/lib/plurimath/math/function/int.rb +5 -1
  23. data/lib/plurimath/math/function/intent.rb +6 -2
  24. data/lib/plurimath/math/function/lim.rb +5 -1
  25. data/lib/plurimath/math/function/linebreak.rb +2 -2
  26. data/lib/plurimath/math/function/longdiv.rb +3 -0
  27. data/lib/plurimath/math/function/menclose.rb +3 -0
  28. data/lib/plurimath/math/function/merror.rb +5 -2
  29. data/lib/plurimath/math/function/mglyph.rb +27 -0
  30. data/lib/plurimath/math/function/mlabeledtr.rb +19 -0
  31. data/lib/plurimath/math/function/mpadded.rb +28 -1
  32. data/lib/plurimath/math/function/ms.rb +80 -0
  33. data/lib/plurimath/math/function/msgroup.rb +15 -0
  34. data/lib/plurimath/math/function/msline.rb +5 -2
  35. data/lib/plurimath/math/function/multiscript.rb +14 -0
  36. data/lib/plurimath/math/function/nary.rb +13 -1
  37. data/lib/plurimath/math/function/oint.rb +5 -1
  38. data/lib/plurimath/math/function/over.rb +3 -0
  39. data/lib/plurimath/math/function/overset.rb +11 -0
  40. data/lib/plurimath/math/function/phantom.rb +3 -0
  41. data/lib/plurimath/math/function/power.rb +3 -0
  42. data/lib/plurimath/math/function/power_base.rb +3 -0
  43. data/lib/plurimath/math/function/prod.rb +5 -1
  44. data/lib/plurimath/math/function/root.rb +3 -0
  45. data/lib/plurimath/math/function/scarries.rb +3 -0
  46. data/lib/plurimath/math/function/semantics.rb +14 -0
  47. data/lib/plurimath/math/function/sqrt.rb +3 -0
  48. data/lib/plurimath/math/function/stackrel.rb +3 -0
  49. data/lib/plurimath/math/function/sum.rb +5 -1
  50. data/lib/plurimath/math/function/table/array.rb +1 -1
  51. data/lib/plurimath/math/function/table/bmatrix.rb +1 -1
  52. data/lib/plurimath/math/function/table/cases.rb +2 -2
  53. data/lib/plurimath/math/function/table/eqarray.rb +2 -2
  54. data/lib/plurimath/math/function/table/pmatrix.rb +1 -1
  55. data/lib/plurimath/math/function/table/vmatrix.rb +1 -1
  56. data/lib/plurimath/math/function/table.rb +65 -0
  57. data/lib/plurimath/math/function/td.rb +4 -1
  58. data/lib/plurimath/math/function/text.rb +22 -2
  59. data/lib/plurimath/math/function/tr.rb +13 -0
  60. data/lib/plurimath/math/function/unary_function.rb +5 -1
  61. data/lib/plurimath/math/function/underover.rb +3 -0
  62. data/lib/plurimath/math/function/underset.rb +44 -0
  63. data/lib/plurimath/math/number.rb +10 -1
  64. data/lib/plurimath/math/symbols/bigwedge.rb +4 -0
  65. data/lib/plurimath/math/symbols/cap.rb +0 -4
  66. data/lib/plurimath/math/symbols/clockoint.rb +1 -1
  67. data/lib/plurimath/math/symbols/cntclockoint.rb +1 -1
  68. data/lib/plurimath/math/symbols/coprod.rb +1 -1
  69. data/lib/plurimath/math/symbols/dd.rb +4 -0
  70. data/lib/plurimath/math/symbols/dint.rb +4 -0
  71. data/lib/plurimath/math/symbols/duni.rb +4 -0
  72. data/lib/plurimath/math/symbols/gg.rb +4 -4
  73. data/lib/plurimath/math/symbols/ii.rb +4 -0
  74. data/lib/plurimath/math/symbols/iiiint.rb +1 -1
  75. data/lib/plurimath/math/symbols/iiint.rb +4 -0
  76. data/lib/plurimath/math/symbols/iint.rb +1 -1
  77. data/lib/plurimath/math/symbols/intclockwise.rb +1 -1
  78. data/lib/plurimath/math/symbols/intercal.rb +4 -0
  79. data/lib/plurimath/math/symbols/jj.rb +4 -0
  80. data/lib/plurimath/math/symbols/ll.rb +4 -4
  81. data/lib/plurimath/math/symbols/minus.rb +1 -1
  82. data/lib/plurimath/math/symbols/oiiint.rb +1 -1
  83. data/lib/plurimath/math/symbols/oiint.rb +1 -1
  84. data/lib/plurimath/math/symbols/oint.rb +1 -1
  85. data/lib/plurimath/math/symbols/symbol.rb +12 -4
  86. data/lib/plurimath/math/symbols/upcase_dd.rb +4 -0
  87. data/lib/plurimath/math.rb +2 -0
  88. data/lib/plurimath/mathml/parser.rb +45 -86
  89. data/lib/plurimath/mathml/utility/empty_defined_methods.rb +477 -0
  90. data/lib/plurimath/mathml/utility/formula_transformation.rb +472 -0
  91. data/lib/plurimath/mathml/utility.rb +363 -0
  92. data/lib/plurimath/mathml.rb +1 -0
  93. data/lib/plurimath/unicode_math/transform.rb +2 -2
  94. data/lib/plurimath/utility/intent_encoding.rb +21 -21
  95. data/lib/plurimath/utility.rb +5 -23
  96. data/lib/plurimath/version.rb +1 -1
  97. data/lib/plurimath.rb +9 -0
  98. data/plurimath.gemspec +4 -2
  99. metadata +38 -5
  100. data/lib/plurimath/mathml/transform.rb +0 -411
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "unary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Ms < UnaryFunction
10
+ include Mathml::Utility
11
+
9
12
  def to_mathml_without_math_tag(intent, **)
10
13
  Utility.ox_element("ms") << parameter_one
11
14
  end
@@ -27,6 +30,83 @@ module Plurimath
27
30
  def to_unicodemath(options:)
28
31
  Text.new(parameter_one).to_unicodemath(options: options)
29
32
  end
33
+
34
+ def value
35
+ parameter_one
36
+ end
37
+
38
+ def value=(content)
39
+ internal_content = updated_temp_mathml_values.flatten.map(&:to_ms_value)
40
+ @parameter_one = [internal_content, content.is_a?(String) ? content : content].flatten.compact.join(" ")
41
+ end
42
+
43
+ def mi_value=(value)
44
+ return if value.nil?
45
+
46
+ @temp_mathml_order = replace_order_with_value(
47
+ @temp_mathml_order,
48
+ value,
49
+ "mi"
50
+ )
51
+ end
52
+
53
+ def mn_value=(value)
54
+ return if value.nil?
55
+
56
+ @temp_mathml_order = replace_order_with_value(
57
+ @temp_mathml_order,
58
+ value,
59
+ "mn"
60
+ )
61
+ end
62
+
63
+ def mo_value=(value)
64
+ return if value.nil?
65
+
66
+ @temp_mathml_order = replace_order_with_value(
67
+ @temp_mathml_order,
68
+ value,
69
+ "mo"
70
+ )
71
+ end
72
+
73
+ def msub_value=(value)
74
+ return if value.nil?
75
+
76
+ @temp_mathml_order = replace_order_with_value(
77
+ @temp_mathml_order,
78
+ value,
79
+ "msub"
80
+ )
81
+ end
82
+
83
+ def msup_value=(value)
84
+ return if value.nil?
85
+
86
+ @temp_mathml_order = replace_order_with_value(
87
+ @temp_mathml_order,
88
+ value,
89
+ "msup"
90
+ )
91
+ end
92
+
93
+ def msubsup_value=(value)
94
+ return if value.nil?
95
+
96
+ @temp_mathml_order = replace_order_with_value(
97
+ @temp_mathml_order,
98
+ value,
99
+ "msubsup"
100
+ )
101
+ end
102
+
103
+ def updated_temp_mathml_values
104
+ @temp_mathml_order.map do |element|
105
+ next element if element.is_a?(Math::Symbols::Symbol)
106
+
107
+ update_temp_mathml_values([element])
108
+ end
109
+ end
30
110
  end
31
111
  end
32
112
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "unary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Msgroup < UnaryFunction
10
+ include Mathml::Utility
11
+
9
12
  def to_asciimath(options:)
10
13
  parameter_one.map { |param| param.to_asciimath(options: options) }.join
11
14
  end
@@ -71,6 +74,18 @@ module Plurimath
71
74
  def line_breaking(obj)
72
75
  custom_array_line_breaking(obj)
73
76
  end
77
+
78
+ def msgroup_text; end
79
+
80
+ def msgroup_text=(value)
81
+ return unless value
82
+
83
+ if value.is_a?(Array) && value.none? { |element| element.match?(/[^\s]/) }
84
+ @temp_mathml_order << Text.new(value.pop)
85
+ else
86
+ @temp_mathml_order << Text.new(value)
87
+ end
88
+ end
74
89
  end
75
90
  end
76
91
  end
@@ -1,14 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "unary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Msline < UnaryFunction
9
- def to_asciimath(**);end
10
+ include Mathml::Utility
10
11
 
11
- def to_latex(**);end
12
+ def to_asciimath(**); end
13
+
14
+ def to_latex(**); end
12
15
 
13
16
  def to_mathml_without_math_tag(intent, **)
14
17
  ox_element("msline")
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "ternary_function"
4
+ require_relative "../../mathml/utility"
5
+
4
6
  module Plurimath
5
7
  module Math
6
8
  module Function
7
9
  class Multiscript < TernaryFunction
10
+ include Mathml::Utility
11
+
8
12
  FUNCTION = {
9
13
  name: "multiscript",
10
14
  first_value: "base",
@@ -79,6 +83,16 @@ module Plurimath
79
83
  end
80
84
  end
81
85
 
86
+ def none_value=(value)
87
+ return if value.nil? || value.empty?
88
+
89
+ @temp_mathml_order = replace_order_with_value(
90
+ @temp_mathml_order,
91
+ value,
92
+ "none"
93
+ )
94
+ end
95
+
82
96
  private
83
97
 
84
98
  def prescripts
@@ -124,6 +124,17 @@ module Plurimath
124
124
  end
125
125
  end
126
126
 
127
+ def intent_names
128
+ @@names ||= Symbols::Symbol.descendants.map.with_object({}) do |symbol, hash|
129
+ sym_instance = symbol.new
130
+ next unless sym_instance.is_nary_symbol?
131
+
132
+ intent_name = sym_instance.nary_intent_name
133
+ next pp symbol.const_source_location(:INPUT) if intent_name.nil?
134
+ hash[intent_name.gsub(/\s|-/, '_').to_sym] = intent_name
135
+ end
136
+ end
137
+
127
138
  protected
128
139
 
129
140
  def chr_value(narypr, options:)
@@ -197,8 +208,9 @@ module Plurimath
197
208
  end
198
209
  end
199
210
 
211
+ # Function calling intent name for a specific symbol
200
212
  def intent_name
201
- return "n-ary" unless parameter_one&.is_nary_symbol?
213
+ return ":n-ary" unless parameter_one&.is_nary_symbol?
202
214
 
203
215
  parameter_one.nary_intent_name
204
216
  end
@@ -119,6 +119,10 @@ module Plurimath
119
119
  true
120
120
  end
121
121
 
122
+ def intent_names
123
+ { name: ":contour integral"}
124
+ end
125
+
122
126
  private
123
127
 
124
128
  def ternary_intentify(tag, intent)
@@ -126,7 +130,7 @@ module Plurimath
126
130
  tag,
127
131
  intent,
128
132
  func_name: :naryand,
129
- intent_name: "contour integral",
133
+ intent_name: intent_names[:name],
130
134
  )
131
135
  end
132
136
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "binary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Over < BinaryFunction
10
+ include Mathml::Utility
11
+
9
12
  FUNCTION = {
10
13
  name: "over",
11
14
  first_value: "numerator",
@@ -1,12 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "binary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Overset < BinaryFunction
10
+ include Mathml::Utility
11
+
9
12
  attr_accessor :options
13
+
10
14
  FUNCTION = {
11
15
  name: "overset",
12
16
  first_value: "base",
@@ -77,6 +81,13 @@ module Plurimath
77
81
  parameter_two.is_nary_function? || parameter_two.is_nary_symbol?
78
82
  end
79
83
 
84
+ def accent=(value)
85
+ return unless value
86
+
87
+ @options ||= {}
88
+ @options[:accent] = value
89
+ end
90
+
80
91
  protected
81
92
 
82
93
  def unicode_accent?(field)
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "unary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Phantom < UnaryFunction
10
+ include Mathml::Utility
11
+
9
12
  def to_asciimath(options:)
10
13
  "#{Array.new(asciimath_value(options: options)&.length, '\ ').join}"
11
14
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "binary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Power < BinaryFunction
10
+ include Mathml::Utility
11
+
9
12
  FUNCTION = {
10
13
  name: "superscript",
11
14
  first_value: "base",
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "ternary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class PowerBase < TernaryFunction
10
+ include Mathml::Utility
11
+
9
12
  FUNCTION = {
10
13
  name: "subsup",
11
14
  first_value: "base",
@@ -116,6 +116,10 @@ module Plurimath
116
116
  true
117
117
  end
118
118
 
119
+ def intent_names
120
+ { name: ":product" }
121
+ end
122
+
119
123
  private
120
124
 
121
125
  def sup_value(options:)
@@ -152,7 +156,7 @@ module Plurimath
152
156
  tag,
153
157
  intent,
154
158
  func_name: :naryand,
155
- intent_name: :product,
159
+ intent_name: intent_names[:name],
156
160
  )
157
161
  end
158
162
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "binary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Root < BinaryFunction
10
+ include Mathml::Utility
11
+
9
12
  FUNCTION = {
10
13
  name: "root",
11
14
  first_value: "radicand",
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "unary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Scarries < UnaryFunction
10
+ include Mathml::Utility
11
+
9
12
  def to_asciimath(options:)
10
13
  asciimath_value(options: options)
11
14
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "binary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Semantics < BinaryFunction
10
+ include Mathml::Utility
11
+
9
12
  FUNCTION = {
10
13
  name: "semantics",
11
14
  first_value: "first argument",
@@ -41,6 +44,17 @@ module Plurimath
41
44
  end
42
45
  end
43
46
 
47
+ def annotation=(value)
48
+ return unless value
49
+
50
+ @parameter_two = [
51
+ {
52
+ annotation: value,
53
+ }
54
+ ]
55
+ @temp_mathml_order.delete("annotation")
56
+ end
57
+
44
58
  protected
45
59
 
46
60
  def other_tags(array, intent, options:)
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "unary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Sqrt < UnaryFunction
10
+ include Mathml::Utility
11
+
9
12
  attr_accessor :options
10
13
 
11
14
  def to_mathml_without_math_tag(intent, options:)
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "binary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Stackrel < BinaryFunction
10
+ include Mathml::Utility
11
+
9
12
  FUNCTION = {
10
13
  name: "stackrel",
11
14
  first_value: "above",
@@ -122,6 +122,10 @@ module Plurimath
122
122
  true
123
123
  end
124
124
 
125
+ def intent_names
126
+ { name: ":sum"}
127
+ end
128
+
125
129
  private
126
130
 
127
131
  def sum_tag
@@ -138,7 +142,7 @@ module Plurimath
138
142
  tag,
139
143
  intent,
140
144
  func_name: :naryand,
141
- intent_name: :sum,
145
+ intent_name: intent_names[:name],
142
146
  )
143
147
  end
144
148
  end
@@ -42,7 +42,7 @@ module Plurimath
42
42
  def attributes(intent)
43
43
  return table_attribute unless intent
44
44
 
45
- table_attribute.merge(intent: ":equations")
45
+ table_attribute.merge(intent: intent_names[:equations])
46
46
  end
47
47
  end
48
48
  end
@@ -54,7 +54,7 @@ module Plurimath
54
54
  return {} unless intent
55
55
 
56
56
  {
57
- intent: capital_bmatrix? ? ":curly-braced-matrix" : ":bracketed-matrix"
57
+ intent: intent_names.dig(capital_bmatrix? ? :curly_braced_matrix : :bracketed_matrix)
58
58
  }
59
59
  end
60
60
  end
@@ -22,7 +22,7 @@ module Plurimath
22
22
  def to_mathml_without_math_tag(intent, **)
23
23
  table_tag = super
24
24
  set_table_intent(table_tag) if intent
25
- table_tag.attributes["intent"] = ":equations" if intent
25
+ table_tag.attributes["intent"] = intent_names[:equations] if intent
26
26
  table_tag
27
27
  end
28
28
 
@@ -30,7 +30,7 @@ module Plurimath
30
30
 
31
31
  def set_table_intent(tag)
32
32
  table = tag.nodes.find { |tag| tag.name == "mtable" }
33
- table["intent"] = ":cases"
33
+ table["intent"] = intent_names[:cases]
34
34
  end
35
35
  end
36
36
  end
@@ -22,7 +22,7 @@ module Plurimath
22
22
  def to_mathml_without_math_tag(intent, **)
23
23
  matrix = super
24
24
  set_table_intent(matrix) if intent
25
- matrix["intent"] = ":equations" if intent
25
+ matrix["intent"] = intent_names[:equations] if intent
26
26
  matrix
27
27
  end
28
28
 
@@ -32,7 +32,7 @@ module Plurimath
32
32
  matrix = tag.nodes.find { |tag| tag.name == "mtable" }
33
33
  return unless matrix
34
34
 
35
- matrix["intent"] = ":cases"
35
+ matrix["intent"] = intent_names[:cases]
36
36
  end
37
37
  end
38
38
  end
@@ -25,7 +25,7 @@ module Plurimath
25
25
 
26
26
  def to_mathml_without_math_tag(intent, **)
27
27
  matrix = super
28
- matrix["intent"] = ":parenthesized-matrix" if intent
28
+ matrix["intent"] = intent_names[:parenthesized_matrix] if intent
29
29
  matrix
30
30
  end
31
31
  end
@@ -40,7 +40,7 @@ module Plurimath
40
40
  end
41
41
 
42
42
  def intent_attr_value(intent)
43
- capital_vmatrix? ? ":normed-matrix" : ":determinant"
43
+ intent_names.dig(capital_vmatrix? ? :normed_matrix : :determinant)
44
44
  end
45
45
  end
46
46
  end
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../mathml/utility"
4
+
3
5
  module Plurimath
4
6
  module Math
5
7
  module Function
6
8
  class Table < Core
9
+ include Mathml::Utility
10
+
7
11
  attr_accessor :value, :open_paren, :close_paren, :options
8
12
 
9
13
  SIMPLE_TABLES = %w[array align split].freeze
@@ -125,10 +129,71 @@ module Plurimath
125
129
  ]
126
130
  end
127
131
 
132
+ def intent_names
133
+ {
134
+ curly_braced_matrix: ":curly-braced-matrix",
135
+ parenthesized_matrix: ":parenthesized-matrix",
136
+ bracketed_matrix: ":bracketed-matrix",
137
+ normed_matrix: ":normed-matrix",
138
+ determinant: ":determinant",
139
+ equations: ":equations",
140
+ cases: ":cases",
141
+ }
142
+ end
143
+
144
+ def mtr_value=(value)
145
+ return if value.nil? || value.empty?
146
+
147
+ self.value = replace_order_with_value(
148
+ clear_temp_order,
149
+ update_temp_mathml_values(value),
150
+ "mtr"
151
+ )
152
+ end
153
+
154
+ def mlabeledtr_value=(value)
155
+ return if value.nil? || value.empty?
156
+
157
+ self.value = replace_order_with_value(
158
+ clear_temp_order,
159
+ update_temp_mathml_values(value),
160
+ "mlabeledtr"
161
+ )
162
+ end
163
+
164
+ def frame=(value)
165
+ return if value.nil? || value.empty?
166
+
167
+ set_option(:frame, value)
168
+ end
169
+
170
+ def rowlines=(value)
171
+ return if value.nil? || value.empty?
172
+
173
+ set_option(:rowlines, value)
174
+ end
175
+
176
+ def columnlines=(value)
177
+ return if value.nil? || value.empty?
178
+ return if value.split.all? { |val| val.include?("none") }
179
+
180
+ Plurimath::Utility.table_separator(
181
+ value.split,
182
+ @value,
183
+ )
184
+ set_option(:columnlines, value)
185
+ end
186
+
128
187
  protected
129
188
 
189
+ def set_option(option, value)
190
+ @options ||= {}
191
+ @options[option] = value
192
+ end
193
+
130
194
  def mathml_parenthesis(field, intent, options:)
131
195
  return "" unless field
196
+
132
197
  if field&.class_name == "symbol"
133
198
  paren = field&.to_mathml_without_math_tag(intent, options: options)&.nodes&.first
134
199
  return invisible_paren?(paren) ? "" : paren.to_s
@@ -1,14 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "binary_function"
4
+ require_relative "../../mathml/utility"
4
5
 
5
6
  module Plurimath
6
7
  module Math
7
8
  module Function
8
9
  class Td < BinaryFunction
10
+ include Mathml::Utility
11
+
9
12
  def initialize(parameter_one = nil, parameter_two = nil)
10
13
  parameter_one&.delete_if { |td| td == "&" }
11
- super(parameter_one, parameter_two)
14
+ super(Array(parameter_one), parameter_two)
12
15
  end
13
16
 
14
17
  def to_asciimath(options:)