plurimath 0.3.5 → 0.3.6

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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/lib/plurimath/asciimath/constants.rb +5 -3
  3. data/lib/plurimath/asciimath/parse.rb +41 -28
  4. data/lib/plurimath/asciimath/transform.rb +111 -0
  5. data/lib/plurimath/latex/constants.rb +2 -2
  6. data/lib/plurimath/latex/parse.rb +3 -0
  7. data/lib/plurimath/latex/transform.rb +37 -0
  8. data/lib/plurimath/math/core.rb +43 -0
  9. data/lib/plurimath/math/formula.rb +33 -25
  10. data/lib/plurimath/math/function/abs.rb +19 -0
  11. data/lib/plurimath/math/function/arccos.rb +3 -0
  12. data/lib/plurimath/math/function/arcsin.rb +3 -0
  13. data/lib/plurimath/math/function/arctan.rb +3 -0
  14. data/lib/plurimath/math/function/bar.rb +2 -1
  15. data/lib/plurimath/math/function/base.rb +5 -7
  16. data/lib/plurimath/math/function/binary_function.rb +11 -61
  17. data/lib/plurimath/math/function/cos.rb +3 -0
  18. data/lib/plurimath/math/function/cosh.rb +3 -0
  19. data/lib/plurimath/math/function/cot.rb +3 -0
  20. data/lib/plurimath/math/function/coth.rb +3 -0
  21. data/lib/plurimath/math/function/csc.rb +3 -0
  22. data/lib/plurimath/math/function/csch.rb +3 -0
  23. data/lib/plurimath/math/function/ddot.rb +13 -0
  24. data/lib/plurimath/math/function/deg.rb +3 -0
  25. data/lib/plurimath/math/function/det.rb +3 -0
  26. data/lib/plurimath/math/function/dim.rb +3 -0
  27. data/lib/plurimath/math/function/exp.rb +3 -0
  28. data/lib/plurimath/math/function/fenced.rb +9 -21
  29. data/lib/plurimath/math/function/font_style.rb +7 -1
  30. data/lib/plurimath/math/function/frac.rb +5 -7
  31. data/lib/plurimath/math/function/gcd.rb +3 -0
  32. data/lib/plurimath/math/function/glb.rb +3 -0
  33. data/lib/plurimath/math/function/hat.rb +4 -0
  34. data/lib/plurimath/math/function/int.rb +36 -6
  35. data/lib/plurimath/math/function/left.rb +10 -3
  36. data/lib/plurimath/math/function/lg.rb +3 -0
  37. data/lib/plurimath/math/function/lim.rb +5 -14
  38. data/lib/plurimath/math/function/limits.rb +8 -0
  39. data/lib/plurimath/math/function/ln.rb +3 -0
  40. data/lib/plurimath/math/function/log.rb +40 -22
  41. data/lib/plurimath/math/function/lub.rb +3 -0
  42. data/lib/plurimath/math/function/max.rb +3 -0
  43. data/lib/plurimath/math/function/mbox.rb +1 -3
  44. data/lib/plurimath/math/function/menclose.rb +2 -1
  45. data/lib/plurimath/math/function/min.rb +3 -0
  46. data/lib/plurimath/math/function/msgroup.rb +1 -4
  47. data/lib/plurimath/math/function/multiscript.rb +4 -9
  48. data/lib/plurimath/math/function/obrace.rb +8 -0
  49. data/lib/plurimath/math/function/overset.rb +3 -16
  50. data/lib/plurimath/math/function/power.rb +5 -8
  51. data/lib/plurimath/math/function/power_base.rb +9 -39
  52. data/lib/plurimath/math/function/prod.rb +34 -4
  53. data/lib/plurimath/math/function/right.rb +10 -3
  54. data/lib/plurimath/math/function/root.rb +6 -4
  55. data/lib/plurimath/math/function/rule.rb +1 -1
  56. data/lib/plurimath/math/function/sec.rb +3 -0
  57. data/lib/plurimath/math/function/sech.rb +3 -0
  58. data/lib/plurimath/math/function/sin.rb +3 -0
  59. data/lib/plurimath/math/function/sinh.rb +3 -0
  60. data/lib/plurimath/math/function/sqrt.rb +4 -3
  61. data/lib/plurimath/math/function/sum.rb +31 -27
  62. data/lib/plurimath/math/function/table.rb +48 -6
  63. data/lib/plurimath/math/function/tan.rb +3 -0
  64. data/lib/plurimath/math/function/tanh.rb +3 -0
  65. data/lib/plurimath/math/function/td.rb +4 -1
  66. data/lib/plurimath/math/function/ternary_function.rb +34 -17
  67. data/lib/plurimath/math/function/text.rb +11 -0
  68. data/lib/plurimath/math/function/tr.rb +1 -0
  69. data/lib/plurimath/math/function/ubrace.rb +8 -0
  70. data/lib/plurimath/math/function/ul.rb +2 -1
  71. data/lib/plurimath/math/function/unary_function.rb +10 -9
  72. data/lib/plurimath/math/function/underover.rb +10 -27
  73. data/lib/plurimath/math/function/underset.rb +3 -16
  74. data/lib/plurimath/math/number.rb +17 -3
  75. data/lib/plurimath/math/symbol.rb +20 -2
  76. data/lib/plurimath/math.rb +1 -1
  77. data/lib/plurimath/mathml/parser.rb +9 -1
  78. data/lib/plurimath/mathml/transform.rb +21 -1
  79. data/lib/plurimath/omml/parser.rb +8 -1
  80. data/lib/plurimath/omml/transform.rb +27 -13
  81. data/lib/plurimath/utility.rb +18 -8
  82. data/lib/plurimath/version.rb +1 -1
  83. metadata +3 -3
  84. data/lib/plurimath/math/base.rb +0 -15
@@ -3,7 +3,7 @@
3
3
  module Plurimath
4
4
  module Math
5
5
  module Function
6
- class BinaryFunction
6
+ class BinaryFunction < Core
7
7
  attr_accessor :parameter_one, :parameter_two
8
8
 
9
9
  def initialize(parameter_one = nil, parameter_two = nil)
@@ -51,9 +51,9 @@ module Plurimath
51
51
 
52
52
  def to_omml_without_math_tag
53
53
  r_tag = Utility.ox_element("r", namespace: "m")
54
- update_row_tag(r_tag, parameter_one) if parameter_one
55
- update_row_tag(r_tag, parameter_two) if parameter_two
56
- r_tag
54
+ Utility.update_nodes(r_tag, [parameter_one.insert_t_tag]) if parameter_one
55
+ Utility.update_nodes(r_tag, [parameter_two.insert_t_tag]) if parameter_two
56
+ [r_tag]
57
57
  end
58
58
 
59
59
  def class_name
@@ -62,79 +62,29 @@ module Plurimath
62
62
 
63
63
  protected
64
64
 
65
- def update_row_tag(tag, field)
66
- first_value = field.to_omml_without_math_tag
67
- first_value = if first_value.is_a?(String)
68
- Utility.ox_element("t", namespace: "m") << first_value
69
- end
70
- Utility.update_nodes(
71
- tag,
72
- first_value.is_a?(Array) ? first_value : [first_value],
73
- )
74
- end
75
-
76
65
  def latex_wrapped(field)
77
- if validate_function_formula(field)
66
+ if field.validate_function_formula
78
67
  "{ \\left ( #{field.to_latex} \\right ) }"
79
68
  else
80
69
  "{#{field.to_latex}}"
81
70
  end
82
71
  end
83
72
 
84
- def validate_function_formula(field)
85
- unary_classes = (Utility::UNARY_CLASSES + ["obrace", "ubrace", "hat"])
86
- if field.is_a?(Formula)
87
- !(field.value.any?(Left) || field.value.any?(Right))
88
- elsif unary_classes.include?(field.class_name)
89
- false
90
- elsif field.class.name.include?("Function") || field.is_a?(FontStyle)
91
- !field.is_a?(Text)
92
- end
93
- end
94
-
95
- def mathml_wrapped(field)
96
- if validate_function_formula(field)
97
- mrow_tag = Utility.ox_element("mrow")
98
- open_paren = (Utility.ox_element("mo") << "(")
99
- close_paren = (Utility.ox_element("mo") << ")")
100
- Utility.update_nodes(
101
- mrow_tag,
102
- [
103
- open_paren,
104
- field.to_mathml_without_math_tag,
105
- close_paren,
106
- ],
107
- )
108
- else
109
- field.to_mathml_without_math_tag
110
- end
111
- end
112
-
113
73
  def wrapped(field)
114
74
  return "" unless field
115
75
 
116
76
  "(#{field.to_asciimath})"
117
77
  end
118
78
 
119
- def asciimath_base_value(field)
120
- if validate_function_formula(field)
121
- "(#{field.to_asciimath})"
122
- else
123
- field.to_asciimath
124
- end
125
- end
126
-
127
- def latex_base_value(field)
128
- if validate_function_formula(field)
129
- "{ \\left ( #{field.to_latex} \\right ) }"
130
- else
131
- field.to_latex
132
- end
133
- end
134
-
135
79
  def invert_unicode_symbols
136
80
  Mathml::Constants::UNICODE_SYMBOLS.invert[class_name] || class_name
137
81
  end
82
+
83
+ def empty_tag(wrapper_tag)
84
+ r_tag = Utility.ox_element("r", namespace: "m")
85
+ r_tag << (Utility.ox_element("t", namespace: "m") << "&#8203;")
86
+ wrapper_tag << r_tag
87
+ end
138
88
  end
139
89
  end
140
90
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Cos < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Cosh < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Cot < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Coth < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Csc < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Csch < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -13,6 +13,19 @@ module Plurimath
13
13
  mathml_value << second_value,
14
14
  )
15
15
  end
16
+
17
+ def to_omml_without_math_tag
18
+ acc_tag = Utility.ox_element("acc", namespace: "m")
19
+ acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
20
+ acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": ".." }))
21
+ me = Utility.ox_element("e", namespace: "m")
22
+ Utility.update_nodes(me, omml_value)
23
+ Utility.update_nodes(
24
+ acc_tag,
25
+ [acc_pr_tag, me],
26
+ )
27
+ [acc_tag]
28
+ end
16
29
  end
17
30
  end
18
31
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Deg < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Det < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Dim < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Exp < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -46,8 +46,15 @@ module Plurimath
46
46
  dpr << Utility.pr_element("ctrl", true, namespace: "m")
47
47
  Utility.update_nodes(
48
48
  d,
49
- [dpr] + Array(second_value),
49
+ [
50
+ dpr,
51
+ omml_parameter(
52
+ Formula.new(Array(parameter_two)),
53
+ tag_name: "e",
54
+ ),
55
+ ],
50
56
  )
57
+ [d]
51
58
  end
52
59
 
53
60
  protected
@@ -64,18 +71,6 @@ module Plurimath
64
71
  )
65
72
  end
66
73
 
67
- def second_value
68
- class_names = ["number", "symbol"].freeze
69
- parameter_two&.map do |object|
70
- e_tag = Utility.ox_element("e", namespace: "m")
71
- e_tag << if class_names.include?(object.class_name)
72
- fenced_omml_value(object)
73
- else
74
- object&.to_omml_without_math_tag
75
- end
76
- end
77
- end
78
-
79
74
  def third_value(dpr)
80
75
  third_value = parameter_three&.value
81
76
  return dpr if third_value.nil? || third_value.empty?
@@ -88,18 +83,11 @@ module Plurimath
88
83
  )
89
84
  end
90
85
 
91
- def fenced_omml_value(object)
92
- r_tag = Utility.ox_element("r", namespace: "m")
93
- t_tag = Utility.ox_element("t", namespace: "m")
94
- t_tag << object&.value
95
- r_tag << t_tag
96
- end
97
-
98
86
  def latex_paren(paren)
99
87
  return "" if paren.nil? || paren.empty?
100
88
 
101
89
  paren = %w[{ }].include?(paren) ? "\\#{paren}" : paren
102
- paren = "\\#{Latex::Constants::UNICODE_SYMBOLS.invert[paren]}" if paren.to_s.match?(/\&#x.{0,4};/)
90
+ paren = "\\#{Latex::Constants::UNICODE_SYMBOLS.invert[paren]}" if paren.to_s.match?(/&#x.{0,4};/)
103
91
  paren.to_s
104
92
  end
105
93
 
@@ -22,7 +22,9 @@ module Plurimath
22
22
  end
23
23
 
24
24
  def to_omml_without_math_tag
25
- parameter_one&.to_omml_without_math_tag
25
+ r_tag = Utility.ox_element("r", namespace: "m")
26
+ Utility.update_nodes(r_tag, parameter_one&.insert_t_tag)
27
+ [r_tag]
26
28
  end
27
29
 
28
30
  def to_html
@@ -32,6 +34,10 @@ module Plurimath
32
34
  def to_latex
33
35
  parameter_one&.to_latex
34
36
  end
37
+
38
+ def validate_function_formula
39
+ true
40
+ end
35
41
  end
36
42
  end
37
43
  end
@@ -34,18 +34,16 @@ module Plurimath
34
34
  def to_omml_without_math_tag
35
35
  f_element = Utility.ox_element("f", namespace: "m")
36
36
  fpr_element = Utility.ox_element("fPr", namespace: "m")
37
- num_element = Utility.ox_element("num", namespace: "m")
38
- num_element << parameter_one.to_omml_without_math_tag if parameter_one
39
- den_element = Utility.ox_element("den", namespace: "m")
40
- den_element << parameter_two.to_omml_without_math_tag if parameter_two
37
+ fpr_element << Utility.pr_element("ctrl", true, namespace: "m")
41
38
  Utility.update_nodes(
42
39
  f_element,
43
40
  [
44
- fpr_element << Utility.pr_element("ctrl", true, namespace: "m"),
45
- num_element,
46
- den_element,
41
+ fpr_element,
42
+ omml_parameter(parameter_one, tag_name: "num"),
43
+ omml_parameter(parameter_two, tag_name: "den"),
47
44
  ],
48
45
  )
46
+ [f_element]
49
47
  end
50
48
  end
51
49
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Gcd < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Glb < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -18,6 +18,10 @@ module Plurimath
18
18
  ],
19
19
  )
20
20
  end
21
+
22
+ def validate_function_formula
23
+ false
24
+ end
21
25
  end
22
26
  end
23
27
  end
@@ -1,36 +1,66 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "binary_function"
3
+ require_relative "ternary_function"
4
4
 
5
5
  module Plurimath
6
6
  module Math
7
7
  module Function
8
- class Int < BinaryFunction
8
+ class Int < TernaryFunction
9
9
  def to_asciimath
10
10
  first_value = "_#{wrapped(parameter_one)}" if parameter_one
11
11
  second_value = "^#{wrapped(parameter_two)}" if parameter_two
12
- "int#{first_value}#{second_value}"
12
+ "int#{first_value}#{second_value} #{parameter_three&.to_asciimath}".strip
13
13
  end
14
14
 
15
15
  def to_latex
16
16
  first_value = "_#{latex_wrapped(parameter_one)}" if parameter_one
17
17
  second_value = "^#{latex_wrapped(parameter_two)}" if parameter_two
18
- "\\#{class_name}#{first_value}#{second_value}"
18
+ "\\#{class_name}#{first_value}#{second_value} #{parameter_three&.to_latex}".strip
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag
22
- mrow_tag = Utility.ox_element("msubsup")
22
+ msubsup_tag = Utility.ox_element("msubsup")
23
23
  mo_tag = Utility.ox_element("mo") << invert_unicode_symbols.to_s
24
24
  first_value = parameter_one&.to_mathml_without_math_tag if parameter_one
25
25
  second_value = parameter_two&.to_mathml_without_math_tag if parameter_two
26
26
  Utility.update_nodes(
27
- mrow_tag,
27
+ msubsup_tag,
28
28
  [
29
29
  mo_tag,
30
30
  first_value,
31
31
  second_value,
32
32
  ],
33
33
  )
34
+ return msubsup_tag if parameter_three.nil?
35
+
36
+ Utility.update_nodes(
37
+ Utility.ox_element("mrow"),
38
+ [
39
+ msubsup_tag,
40
+ parameter_three&.to_mathml_without_math_tag,
41
+ ].flatten.compact,
42
+ )
43
+ end
44
+
45
+ def to_omml_without_math_tag
46
+ if all_values_exist?
47
+ nary = Utility.ox_element("nary", namespace: "m")
48
+ Utility.update_nodes(
49
+ nary,
50
+ [
51
+ narypr("∫", function_type: "subSup"),
52
+ omml_parameter(parameter_one, tag_name: "sub"),
53
+ omml_parameter(parameter_two, tag_name: "sup"),
54
+ omml_parameter(parameter_three, tag_name: "e"),
55
+ ],
56
+ )
57
+ [nary]
58
+ else
59
+ r_tag = Utility.ox_element("r", namespace: "m")
60
+ t_tag = Utility.ox_element("t", namespace: "m")
61
+ r_tag << (t_tag << "&#x222b;")
62
+ [r_tag]
63
+ end
34
64
  end
35
65
  end
36
66
  end
@@ -17,9 +17,12 @@ module Plurimath
17
17
  end
18
18
 
19
19
  def to_omml_without_math_tag
20
- mt = Utility.ox_element("m:t")
21
- mt << parameter_one if parameter_one
22
- mt
20
+ mr = Utility.ox_element("m:r")
21
+ if parameter_one
22
+ mt = Utility.ox_element("m:t")
23
+ mr << (mt << parameter_one)
24
+ end
25
+ [mr]
23
26
  end
24
27
 
25
28
  def to_html
@@ -30,6 +33,10 @@ module Plurimath
30
33
  "\\left #{Latex::Constants::LEFT_RIGHT_PARENTHESIS.invert[parameter_one] || '.'}"
31
34
  end
32
35
 
36
+ def validate_function_formula
37
+ false
38
+ end
39
+
33
40
  protected
34
41
 
35
42
  def left_paren
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Lg < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -40,20 +40,11 @@ module Plurimath
40
40
  end
41
41
 
42
42
  def to_omml_without_math_tag
43
- limupp = Utility.ox_element("limUpp", namespace: "m")
44
- limpr = Utility.ox_element("limUppPr", namespace: "m")
45
- limpr << Utility.pr_element("ctrl", namespace: "m")
46
- e_tag = Utility.ox_element("e", namespace: "m")
47
- e_tag << parameter_one&.to_omml_without_math_tag
48
- lim = Utility.ox_element("lim", namespace: "m")
49
- lim << parameter_two&.to_omml_without_math_tag if parameter_two
50
- Utility.update_nodes(
51
- limupp,
52
- [
53
- e_tag,
54
- lim,
55
- ],
56
- )
43
+ lim = Symbol.new("lim")
44
+ overset = Overset.new(lim, parameter_two)
45
+ return overset unless parameter_one
46
+
47
+ Underset.new(overset, parameter_one)&.to_omml_without_math_tag
57
48
  end
58
49
  end
59
50
  end
@@ -21,6 +21,14 @@ module Plurimath
21
21
  third_value = "{#{parameter_three.to_latex}}" if parameter_three
22
22
  "#{first_value}\\#{class_name}_#{second_value}^#{third_value}"
23
23
  end
24
+
25
+ def to_omml_without_math_tag
26
+ value_array = []
27
+ value_array << parameter_one.insert_t_tag if parameter_one
28
+ value_array << parameter_two.insert_t_tag if parameter_two
29
+ value_array << parameter_three.insert_t_tag if parameter_three
30
+ value_array
31
+ end
24
32
  end
25
33
  end
26
34
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Ln < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -25,22 +25,21 @@ module Plurimath
25
25
  end
26
26
 
27
27
  def to_omml_without_math_tag
28
- func = Utility.ox_element("func", namespace: "m")
29
- funcpr = Utility.ox_element("funcPr", namespace: "m")
30
- funcpr << Utility.pr_element("ctrl", true, namespace: "m")
31
- fname = Utility.ox_element("fName", namespace: "m")
32
- mr = Utility.ox_element("r", namespace: "m")
33
- rpr = Utility.rpr_element
34
- mt = Utility.ox_element("t", namespace: "m") << class_name
35
- fname << Utility.update_nodes(mr, [rpr, mt])
36
- log_values = [first_value, second_value].flatten.compact
28
+ ssubsup = Utility.ox_element("sSubSup", namespace: "m")
29
+ ssubsuppr = Utility.ox_element("sSubSupPr", namespace: "m")
30
+ ssubsuppr << hide_tags(
31
+ Utility.pr_element("ctrl", true, namespace: "m"),
32
+ )
37
33
  Utility.update_nodes(
38
- func,
34
+ ssubsup,
39
35
  [
40
- funcpr,
41
- fname,
42
- ] + log_values,
36
+ ssubsuppr,
37
+ e_parameter,
38
+ omml_parameter(parameter_one, tag_name: "sub"),
39
+ omml_parameter(parameter_two, tag_name: "sup"),
40
+ ],
43
41
  )
42
+ [ssubsup]
44
43
  end
45
44
 
46
45
  def to_mathml_without_math_tag
@@ -61,18 +60,37 @@ module Plurimath
61
60
 
62
61
  protected
63
62
 
64
- def first_value
65
- return nil if parameter_one.nil?
66
-
67
- first_value = parameter_one.to_omml_without_math_tag
68
- Utility.ox_element("e", namespace: "m") << first_value
63
+ def e_parameter
64
+ e_tag = Utility.ox_element("e", namespace: "m")
65
+ e_tag << rpr_tag
69
66
  end
70
67
 
71
- def second_value
72
- return nil if parameter_two.nil?
68
+ def hide_tags(nar)
69
+ attr = { "m:val": "1" }
70
+ if parameter_one.nil?
71
+ nar << Utility.ox_element(
72
+ "subHide",
73
+ namespace: "m",
74
+ attributes: attr,
75
+ )
76
+ end
77
+ if parameter_two.nil?
78
+ nar << Utility.ox_element(
79
+ "supHide",
80
+ namespace: "m",
81
+ attributes: attr,
82
+ )
83
+ end
84
+ nar
85
+ end
73
86
 
74
- second_value = parameter_two.to_omml_without_math_tag
75
- Utility.ox_element("e", namespace: "m") << second_value
87
+ def rpr_tag
88
+ sty_atrs = { "m:val": "p" }
89
+ sty_tag = Utility.ox_element("sty", attributes: sty_atrs, namespace: "m")
90
+ rpr_tag = (Utility.ox_element("rPr", namespace: "m") << sty_tag)
91
+ r_tag = Utility.ox_element("r", namespace: "m")
92
+ t_tag = (Utility.ox_element("t", namespace: "m") << "log")
93
+ Utility.update_nodes(r_tag, [rpr_tag, t_tag])
76
94
  end
77
95
  end
78
96
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Lub < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Max < UnaryFunction
9
+ def validate_function_formula
10
+ false
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -21,9 +21,7 @@ module Plurimath
21
21
  end
22
22
 
23
23
  def to_omml_without_math_tag
24
- text = Utility.ox_element("t", namespace: "m")
25
- text << parameter_one.to_omml_without_math_tag if parameter_one
26
- text
24
+ omml_value
27
25
  end
28
26
  end
29
27
  end
@@ -31,7 +31,7 @@ module Plurimath
31
31
  borderpr = Utility.ox_element("borderBoxPr", namespace: "m")
32
32
  borderpr << Utility.pr_element("ctrl", true, namespace: "m")
33
33
  me = Utility.ox_element("e", namespace: "m")
34
- me << parameter_two.to_omml_without_math_tag if parameter_two
34
+ Utility.update_nodes(me, Array(parameter_two.to_omml_without_math_tag)) if parameter_two
35
35
  Utility.update_nodes(
36
36
  borderbox,
37
37
  [
@@ -39,6 +39,7 @@ module Plurimath
39
39
  me,
40
40
  ],
41
41
  )
42
+ [borderbox]
42
43
  end
43
44
  end
44
45
  end