plurimath 0.8.17 → 0.8.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/plurimath/asciimath/parse.rb +1 -0
- data/lib/plurimath/asciimath/transform.rb +12 -0
- data/lib/plurimath/math/core.rb +63 -4
- data/lib/plurimath/math/formula/mrow.rb +193 -0
- data/lib/plurimath/math/formula/mstyle.rb +17 -0
- data/lib/plurimath/math/formula.rb +307 -4
- data/lib/plurimath/math/function/base.rb +4 -0
- data/lib/plurimath/math/function/color.rb +17 -4
- data/lib/plurimath/math/function/fenced.rb +219 -0
- data/lib/plurimath/math/function/frac.rb +4 -0
- data/lib/plurimath/math/function/linebreak.rb +2 -2
- data/lib/plurimath/math/function/longdiv.rb +3 -0
- data/lib/plurimath/math/function/menclose.rb +3 -0
- data/lib/plurimath/math/function/merror.rb +5 -2
- data/lib/plurimath/math/function/mglyph.rb +27 -0
- data/lib/plurimath/math/function/mlabeledtr.rb +19 -0
- data/lib/plurimath/math/function/mpadded.rb +28 -1
- data/lib/plurimath/math/function/ms.rb +80 -0
- data/lib/plurimath/math/function/msgroup.rb +15 -0
- data/lib/plurimath/math/function/msline.rb +5 -2
- data/lib/plurimath/math/function/multiscript.rb +14 -0
- data/lib/plurimath/math/function/over.rb +3 -0
- data/lib/plurimath/math/function/overset.rb +11 -0
- data/lib/plurimath/math/function/phantom.rb +3 -0
- data/lib/plurimath/math/function/power.rb +3 -0
- data/lib/plurimath/math/function/power_base.rb +3 -0
- data/lib/plurimath/math/function/root.rb +3 -0
- data/lib/plurimath/math/function/scarries.rb +3 -0
- data/lib/plurimath/math/function/semantics.rb +14 -0
- data/lib/plurimath/math/function/sqrt.rb +3 -0
- data/lib/plurimath/math/function/stackrel.rb +3 -0
- data/lib/plurimath/math/function/table.rb +53 -0
- data/lib/plurimath/math/function/td.rb +4 -1
- data/lib/plurimath/math/function/text.rb +22 -2
- data/lib/plurimath/math/function/tr.rb +13 -0
- data/lib/plurimath/math/function/underover.rb +3 -0
- data/lib/plurimath/math/function/underset.rb +44 -0
- data/lib/plurimath/math/number.rb +10 -1
- data/lib/plurimath/math/symbols/gg.rb +4 -4
- data/lib/plurimath/math/symbols/ll.rb +4 -4
- data/lib/plurimath/math/symbols/minus.rb +1 -1
- data/lib/plurimath/math/symbols/symbol.rb +12 -4
- data/lib/plurimath/math.rb +2 -0
- data/lib/plurimath/mathml/parser.rb +45 -86
- data/lib/plurimath/mathml/utility/empty_defined_methods.rb +477 -0
- data/lib/plurimath/mathml/utility/formula_transformation.rb +472 -0
- data/lib/plurimath/mathml/utility.rb +363 -0
- data/lib/plurimath/mathml.rb +1 -0
- data/lib/plurimath/unicode_math/transform.rb +2 -2
- data/lib/plurimath/utility.rb +5 -23
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath.rb +9 -0
- data/plurimath.gemspec +4 -2
- metadata +37 -5
- data/lib/plurimath/mathml/transform.rb +0 -413
@@ -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 Longdiv < 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 Menclose < BinaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
FUNCTION = {
|
10
13
|
name: "enclosure",
|
11
14
|
first_value: "enclosure type",
|
@@ -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 Merror < UnaryFunction
|
9
|
-
|
10
|
+
include Mathml::Utility
|
10
11
|
|
11
|
-
def
|
12
|
+
def to_asciimath(**); end
|
13
|
+
|
14
|
+
def to_latex(**); end
|
12
15
|
|
13
16
|
def to_mathml_without_math_tag(intent, options:)
|
14
17
|
merror = Utility.ox_element("merror")
|
@@ -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 Mglyph < UnaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
def initialize(parameter_one = {})
|
10
13
|
super(parameter_one)
|
11
14
|
end
|
@@ -34,8 +37,32 @@ module Plurimath
|
|
34
37
|
parameter_one[:alt] if parameter_one
|
35
38
|
end
|
36
39
|
|
40
|
+
def alt; end
|
41
|
+
|
42
|
+
def src; end
|
43
|
+
|
44
|
+
def index; end
|
45
|
+
|
46
|
+
def src=(value)
|
47
|
+
set_option(:src, value)
|
48
|
+
end
|
49
|
+
|
50
|
+
def alt=(value)
|
51
|
+
set_option(:alt, value)
|
52
|
+
end
|
53
|
+
|
54
|
+
def index=(value)
|
55
|
+
set_option(:index, value)
|
56
|
+
end
|
57
|
+
|
37
58
|
protected
|
38
59
|
|
60
|
+
def set_option(option, value)
|
61
|
+
return if value.nil?
|
62
|
+
|
63
|
+
parameter_one[option] = value
|
64
|
+
end
|
65
|
+
|
39
66
|
def glyph_user_index(index)
|
40
67
|
return "" unless index > 0
|
41
68
|
|
@@ -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 Mlabeledtr < BinaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
def to_mathml_without_math_tag(intent, options:)
|
10
13
|
table = ox_element("mtable")
|
11
14
|
mlabeledtr = ox_element(class_name)
|
@@ -18,6 +21,22 @@ module Plurimath
|
|
18
21
|
"#{parameter_one&.to_unicodemath(options: options)}##{parameter_two&.value}"
|
19
22
|
end
|
20
23
|
|
24
|
+
def id=(value)
|
25
|
+
return if value.nil?
|
26
|
+
|
27
|
+
@parameter_two = Text.new(value)
|
28
|
+
end
|
29
|
+
|
30
|
+
def mtd_value=(value)
|
31
|
+
return if value.nil? || value.empty?
|
32
|
+
|
33
|
+
self.parameter_one = replace_order_with_value(
|
34
|
+
clear_temp_order,
|
35
|
+
update_temp_mathml_values(value),
|
36
|
+
"mtd"
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
21
40
|
protected
|
22
41
|
|
23
42
|
def labeledtr_td(tr, value)
|
@@ -1,12 +1,16 @@
|
|
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 Mpadded < UnaryFunction
|
10
|
+
include Mathml::Utility
|
11
|
+
|
9
12
|
attr_accessor :options
|
13
|
+
|
10
14
|
ZERO_TAGS = {
|
11
15
|
height: "zeroAsc",
|
12
16
|
depth: "zeroDesc",
|
@@ -58,11 +62,34 @@ module Plurimath
|
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
65
|
+
def voffset; end
|
66
|
+
|
67
|
+
def voffset=(value); end
|
68
|
+
|
69
|
+
def height=(value)
|
70
|
+
set_option(:height, value)
|
71
|
+
end
|
72
|
+
|
73
|
+
def depth=(value)
|
74
|
+
set_option(:depth, value)
|
75
|
+
end
|
76
|
+
|
77
|
+
def width=(value)
|
78
|
+
set_option(:width, value)
|
79
|
+
end
|
80
|
+
|
61
81
|
protected
|
62
82
|
|
83
|
+
def set_option(option, value)
|
84
|
+
return if value.nil?
|
85
|
+
|
86
|
+
@options ||= {}
|
87
|
+
@options[option] = value
|
88
|
+
end
|
89
|
+
|
63
90
|
def phant_pr
|
64
91
|
attributes = { "m:val": "on" }
|
65
|
-
options
|
92
|
+
options&.map do |atr, value|
|
66
93
|
ox_element(ZERO_TAGS[atr], attributes: attributes) if attr_value_zero?(value)
|
67
94
|
end
|
68
95
|
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 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
|
-
|
10
|
+
include Mathml::Utility
|
10
11
|
|
11
|
-
def
|
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
|
@@ -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",
|
@@ -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",
|
@@ -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
|
@@ -137,10 +141,59 @@ module Plurimath
|
|
137
141
|
}
|
138
142
|
end
|
139
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
|
+
|
140
187
|
protected
|
141
188
|
|
189
|
+
def set_option(option, value)
|
190
|
+
@options ||= {}
|
191
|
+
@options[option] = value
|
192
|
+
end
|
193
|
+
|
142
194
|
def mathml_parenthesis(field, intent, options:)
|
143
195
|
return "" unless field
|
196
|
+
|
144
197
|
if field&.class_name == "symbol"
|
145
198
|
paren = field&.to_mathml_without_math_tag(intent, options: options)&.nodes&.first
|
146
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:)
|