plurimath 0.11.5 → 0.11.7

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 (112) hide show
  1. checksums.yaml +4 -4
  2. data/lib/plurimath/asciimath/utility.rb +50 -0
  3. data/lib/plurimath/asciimath.rb +1 -0
  4. data/lib/plurimath/formatter/numbers/mathml_renderer.rb +15 -15
  5. data/lib/plurimath/formatter/numbers/omml_renderer.rb +19 -19
  6. data/lib/plurimath/html/utility.rb +18 -0
  7. data/lib/plurimath/html.rb +1 -0
  8. data/lib/plurimath/latex/utility.rb +118 -0
  9. data/lib/plurimath/latex.rb +1 -0
  10. data/lib/plurimath/math/core.rb +12 -12
  11. data/lib/plurimath/math/formula.rb +10 -10
  12. data/lib/plurimath/math/function/abs.rb +3 -3
  13. data/lib/plurimath/math/function/bar.rb +14 -14
  14. data/lib/plurimath/math/function/base.rb +15 -7
  15. data/lib/plurimath/math/function/binary_function.rb +7 -7
  16. data/lib/plurimath/math/function/cancel.rb +2 -2
  17. data/lib/plurimath/math/function/ceil.rb +1 -1
  18. data/lib/plurimath/math/function/color.rb +2 -2
  19. data/lib/plurimath/math/function/ddot.rb +3 -3
  20. data/lib/plurimath/math/function/dot.rb +8 -8
  21. data/lib/plurimath/math/function/fenced.rb +8 -8
  22. data/lib/plurimath/math/function/floor.rb +1 -1
  23. data/lib/plurimath/math/function/font_style/bold.rb +2 -2
  24. data/lib/plurimath/math/function/font_style/double_struck.rb +2 -2
  25. data/lib/plurimath/math/function/font_style/fraktur.rb +2 -2
  26. data/lib/plurimath/math/function/font_style/italic.rb +2 -2
  27. data/lib/plurimath/math/function/font_style/monospace.rb +2 -2
  28. data/lib/plurimath/math/function/font_style/normal.rb +2 -2
  29. data/lib/plurimath/math/function/font_style/sans-serif.rb +2 -2
  30. data/lib/plurimath/math/function/font_style/script.rb +2 -2
  31. data/lib/plurimath/math/function/font_style.rb +16 -15
  32. data/lib/plurimath/math/function/frac.rb +7 -7
  33. data/lib/plurimath/math/function/hat.rb +8 -8
  34. data/lib/plurimath/math/function/inf.rb +2 -2
  35. data/lib/plurimath/math/function/int.rb +8 -8
  36. data/lib/plurimath/math/function/left.rb +5 -5
  37. data/lib/plurimath/math/function/lim.rb +3 -3
  38. data/lib/plurimath/math/function/limits.rb +2 -2
  39. data/lib/plurimath/math/function/linebreak.rb +2 -2
  40. data/lib/plurimath/math/function/log.rb +10 -10
  41. data/lib/plurimath/math/function/longdiv.rb +1 -1
  42. data/lib/plurimath/math/function/menclose.rb +2 -2
  43. data/lib/plurimath/math/function/merror.rb +2 -2
  44. data/lib/plurimath/math/function/mod.rb +1 -1
  45. data/lib/plurimath/math/function/mpadded.rb +2 -2
  46. data/lib/plurimath/math/function/ms.rb +2 -2
  47. data/lib/plurimath/math/function/msgroup.rb +2 -2
  48. data/lib/plurimath/math/function/multiscript.rb +2 -2
  49. data/lib/plurimath/math/function/nary.rb +15 -15
  50. data/lib/plurimath/math/function/none.rb +1 -1
  51. data/lib/plurimath/math/function/norm.rb +1 -1
  52. data/lib/plurimath/math/function/obrace.rb +8 -8
  53. data/lib/plurimath/math/function/oint.rb +6 -6
  54. data/lib/plurimath/math/function/over.rb +5 -5
  55. data/lib/plurimath/math/function/overleftrightarrow.rb +7 -7
  56. data/lib/plurimath/math/function/overset.rb +5 -5
  57. data/lib/plurimath/math/function/phantom.rb +9 -9
  58. data/lib/plurimath/math/function/power.rb +5 -5
  59. data/lib/plurimath/math/function/power_base.rb +5 -5
  60. data/lib/plurimath/math/function/prod.rb +4 -4
  61. data/lib/plurimath/math/function/right.rb +5 -5
  62. data/lib/plurimath/math/function/root.rb +7 -7
  63. data/lib/plurimath/math/function/rule.rb +2 -2
  64. data/lib/plurimath/math/function/scarries.rb +1 -1
  65. data/lib/plurimath/math/function/semantics.rb +4 -4
  66. data/lib/plurimath/math/function/sqrt.rb +7 -7
  67. data/lib/plurimath/math/function/stackrel.rb +5 -5
  68. data/lib/plurimath/math/function/substack.rb +1 -1
  69. data/lib/plurimath/math/function/sum.rb +4 -4
  70. data/lib/plurimath/math/function/sup.rb +1 -1
  71. data/lib/plurimath/math/function/table/array.rb +1 -1
  72. data/lib/plurimath/math/function/table/bmatrix.rb +2 -2
  73. data/lib/plurimath/math/function/table/matrix.rb +2 -2
  74. data/lib/plurimath/math/function/table.rb +29 -29
  75. data/lib/plurimath/math/function/td.rb +3 -3
  76. data/lib/plurimath/math/function/ternary_function.rb +13 -13
  77. data/lib/plurimath/math/function/text.rb +4 -4
  78. data/lib/plurimath/math/function/tilde.rb +6 -6
  79. data/lib/plurimath/math/function/tr.rb +4 -4
  80. data/lib/plurimath/math/function/ubrace.rb +1 -1
  81. data/lib/plurimath/math/function/ul.rb +9 -9
  82. data/lib/plurimath/math/function/unary_function.rb +14 -14
  83. data/lib/plurimath/math/function/underover.rb +1 -1
  84. data/lib/plurimath/math/function/underset.rb +12 -12
  85. data/lib/plurimath/math/function/unitsml.rb +1 -1
  86. data/lib/plurimath/math/function/vec.rb +7 -7
  87. data/lib/plurimath/math/model_helper.rb +103 -0
  88. data/lib/plurimath/math/number.rb +2 -2
  89. data/lib/plurimath/math/symbols/symbol.rb +2 -2
  90. data/lib/plurimath/math/symbols/tilde.rb +1 -1
  91. data/lib/plurimath/math.rb +1 -0
  92. data/lib/plurimath/mathml/constants.rb +29 -155
  93. data/lib/plurimath/mathml/formula_transformation.rb +2 -5
  94. data/lib/plurimath/mathml/translator.rb +6 -0
  95. data/lib/plurimath/mathml/utility.rb +53 -0
  96. data/lib/plurimath/mathml.rb +1 -0
  97. data/lib/plurimath/omml/formula_transformation.rb +5 -5
  98. data/lib/plurimath/omml/translator.rb +8 -5
  99. data/lib/plurimath/omml/utility.rb +109 -0
  100. data/lib/plurimath/omml.rb +1 -0
  101. data/lib/plurimath/unicode_math/transform.rb +5 -1
  102. data/lib/plurimath/unicode_math/utility.rb +256 -0
  103. data/lib/plurimath/unicode_math.rb +1 -0
  104. data/lib/plurimath/utility/intent_encoding.rb +4 -4
  105. data/lib/plurimath/utility.rb +6 -815
  106. data/lib/plurimath/version.rb +1 -1
  107. data/lib/plurimath/xml_engine/oga/dumper.rb +8 -1
  108. data/lib/plurimath/xml_engine/ox_engine.rb +4 -1
  109. data/lib/plurimath/xml_helper.rb +47 -0
  110. data/lib/plurimath.rb +1 -0
  111. data/plurimath.gemspec +2 -2
  112. metadata +16 -8
@@ -9,7 +9,7 @@ module Plurimath
9
9
  def initialize(parameter_one = nil, parameter_two = nil)
10
10
  @parameter_one = parameter_one
11
11
  @parameter_two = parameter_two
12
- Utility.validate_left_right(variables.map { |var| get(var) })
12
+ ModelHelper.validate_left_right(variables.map { |var| get(var) })
13
13
  end
14
14
 
15
15
  def to_asciimath(options:)
@@ -25,8 +25,8 @@ module Plurimath
25
25
  end
26
26
 
27
27
  def to_mathml_without_math_tag(intent, options:)
28
- mrow_tag = Utility.ox_element("mrow")
29
- mo_tag = Utility.ox_element("mo") << invert_unicode_symbols.to_s
28
+ mrow_tag = XmlHelper.ox_element("mrow")
29
+ mo_tag = XmlHelper.ox_element("mo") << invert_unicode_symbols.to_s
30
30
  if parameter_one
31
31
  first_value = parameter_one&.to_mathml_without_math_tag(intent,
32
32
  options: options)
@@ -35,7 +35,7 @@ module Plurimath
35
35
  second_value = parameter_two&.to_mathml_without_math_tag(intent,
36
36
  options: options)
37
37
  end
38
- Utility.update_nodes(
38
+ XmlHelper.update_nodes(
39
39
  mrow_tag,
40
40
  [
41
41
  first_value,
@@ -64,14 +64,14 @@ module Plurimath
64
64
  end
65
65
 
66
66
  def to_omml_without_math_tag(display_style, options:)
67
- r_tag = Utility.ox_element("r", namespace: "m")
67
+ r_tag = XmlHelper.ox_element("r", namespace: "m")
68
68
  if parameter_one
69
- Utility.update_nodes(r_tag,
69
+ XmlHelper.update_nodes(r_tag,
70
70
  [parameter_one.insert_t_tag(display_style,
71
71
  options: options)])
72
72
  end
73
73
  if parameter_two
74
- Utility.update_nodes(r_tag,
74
+ XmlHelper.update_nodes(r_tag,
75
75
  [parameter_two.insert_t_tag(display_style,
76
76
  options: options)])
77
77
  end
@@ -5,13 +5,13 @@ module Plurimath
5
5
  module Function
6
6
  class Cancel < UnaryFunction
7
7
  def to_mathml_without_math_tag(intent, options:)
8
- cancel_tag = Utility.ox_element(
8
+ cancel_tag = XmlHelper.ox_element(
9
9
  "menclose",
10
10
  attributes: { notation: "updiagonalstrike" },
11
11
  )
12
12
  first_value = parameter_one&.to_mathml_without_math_tag(intent,
13
13
  options: options)
14
- Utility.update_nodes(cancel_tag, [first_value])
14
+ XmlHelper.update_nodes(cancel_tag, [first_value])
15
15
  end
16
16
 
17
17
  def to_omml_without_math_tag(display_style, options:)
@@ -17,7 +17,7 @@ module Plurimath
17
17
  paren_node("&#x2308;"))
18
18
  end
19
19
  first_value = first_value << paren_node("&#x2309;") unless close_paren
20
- Utility.update_nodes(ox_element("mrow"), first_value)
20
+ XmlHelper.update_nodes(ox_element("mrow"), first_value)
21
21
  end
22
22
 
23
23
  def to_omml_without_math_tag(display_style, options:)
@@ -28,8 +28,8 @@ module Plurimath
28
28
  end
29
29
 
30
30
  def to_mathml_without_math_tag(intent, options:)
31
- Utility.update_nodes(
32
- Utility.ox_element(
31
+ XmlHelper.update_nodes(
32
+ XmlHelper.ox_element(
33
33
  "mstyle",
34
34
  attributes: mathml_options,
35
35
  ),
@@ -12,9 +12,9 @@ module Plurimath
12
12
  end
13
13
 
14
14
  def to_mathml_without_math_tag(intent, options:)
15
- second_value = Utility.ox_element("mo") << ".."
16
- Utility.update_nodes(
17
- Utility.ox_element("mover", attributes: { accent: "true" }),
15
+ second_value = XmlHelper.ox_element("mo") << ".."
16
+ XmlHelper.update_nodes(
17
+ XmlHelper.ox_element("mover", attributes: { accent: "true" }),
18
18
  mathml_value(intent, options: options) << second_value,
19
19
  )
20
20
  end
@@ -12,18 +12,18 @@ module Plurimath
12
12
  end
13
13
 
14
14
  def to_mathml_without_math_tag(intent, options:)
15
- dot_tag = Utility.ox_element("mo") << "."
15
+ dot_tag = XmlHelper.ox_element("mo") << "."
16
16
  return dot_tag unless parameter_one
17
17
 
18
18
  first_value = parameter_one&.to_mathml_without_math_tag(intent,
19
19
  options: options)
20
- dot_tag = (Utility.ox_element("mo") << ".")
21
- over_tag = Utility.ox_element("mover")
20
+ dot_tag = (XmlHelper.ox_element("mo") << ".")
21
+ over_tag = XmlHelper.ox_element("mover")
22
22
  if attributes && attributes[:accent]
23
23
  over_tag[:accent] =
24
24
  attributes[:accent]
25
25
  end
26
- Utility.update_nodes(
26
+ XmlHelper.update_nodes(
27
27
  over_tag,
28
28
  [
29
29
  first_value,
@@ -60,14 +60,14 @@ module Plurimath
60
60
  protected
61
61
 
62
62
  def acc_tag(display_style, options:)
63
- acc_tag = Utility.ox_element("acc", namespace: "m")
64
- acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
65
- acc_pr_tag << Utility.ox_element(
63
+ acc_tag = XmlHelper.ox_element("acc", namespace: "m")
64
+ acc_pr_tag = XmlHelper.ox_element("accPr", namespace: "m")
65
+ acc_pr_tag << XmlHelper.ox_element(
66
66
  "chr",
67
67
  namespace: "m",
68
68
  attributes: { "m:val": "." },
69
69
  )
70
- Utility.update_nodes(
70
+ XmlHelper.update_nodes(
71
71
  acc_tag,
72
72
  [
73
73
  acc_pr_tag,
@@ -41,7 +41,7 @@ module Plurimath
41
41
  intent, options: options) || "")
42
42
  mrow_value = Array(mathml_value(intent, options: options))&.insert(0,
43
43
  first_value)&.<< third_value
44
- fenced = Utility.update_nodes(ox_element("mrow"), mrow_value)
44
+ fenced = XmlHelper.update_nodes(ox_element("mrow"), mrow_value)
45
45
  intentify(
46
46
  fenced,
47
47
  intent,
@@ -81,12 +81,12 @@ module Plurimath
81
81
 
82
82
  def to_omml_without_math_tag(display_style, options:)
83
83
  attrs = { "m:val": (options ? options[:separators] : "") }
84
- d = Utility.ox_element("d", namespace: "m")
85
- dpr = Utility.ox_element("dPr", namespace: "m")
84
+ d = XmlHelper.ox_element("d", namespace: "m")
85
+ dpr = XmlHelper.ox_element("dPr", namespace: "m")
86
86
  open_paren(dpr, options: options)
87
- dpr << Utility.ox_element("sepChr", namespace: "m", attributes: attrs)
87
+ dpr << XmlHelper.ox_element("sepChr", namespace: "m", attributes: attrs)
88
88
  close_paren(dpr, options: options)
89
- Utility.update_nodes(
89
+ XmlHelper.update_nodes(
90
90
  d,
91
91
  [
92
92
  dpr,
@@ -223,7 +223,7 @@ options:)
223
223
  return dpr if first_value.nil?
224
224
 
225
225
  attributes = { "m:val": Utility.html_entity_to_unicode(first_value) }
226
- dpr << Utility.ox_element(
226
+ dpr << XmlHelper.ox_element(
227
227
  "begChr",
228
228
  namespace: "m",
229
229
  attributes: attributes,
@@ -236,7 +236,7 @@ options:)
236
236
  return dpr if third_value.nil?
237
237
 
238
238
  attributes = { "m:val": Utility.html_entity_to_unicode(third_value) }
239
- dpr << Utility.ox_element(
239
+ dpr << XmlHelper.ox_element(
240
240
  "endChr",
241
241
  namespace: "m",
242
242
  attributes: attributes,
@@ -409,7 +409,7 @@ options:)
409
409
  object&.to_mathml_without_math_tag(intent, options: options)
410
410
  end
411
411
  if intent
412
- mrow = Utility.update_nodes(ox_element("mrow"), nodes)
412
+ mrow = XmlHelper.update_nodes(ox_element("mrow"), nodes)
413
413
  update_partial_derivative(nodes) unless mrow.locate("*/mfrac/@intent").empty?
414
414
  end
415
415
  nodes
@@ -19,7 +19,7 @@ module Plurimath
19
19
  ox_element("mo") << "&#x230a;")
20
20
  end
21
21
  value_array << (ox_element("mo") << "&#x230b;") unless close_paren
22
- Utility.update_nodes(ox_element("mrow"), value_array)
22
+ XmlHelper.update_nodes(ox_element("mrow"), value_array)
23
23
  end
24
24
 
25
25
  def to_omml_without_math_tag(display_style, options:)
@@ -19,8 +19,8 @@ module Plurimath
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag(intent, options:)
22
- Utility.update_nodes(
23
- Utility.ox_element(
22
+ XmlHelper.update_nodes(
23
+ XmlHelper.ox_element(
24
24
  "mstyle",
25
25
  attributes: { mathvariant: "bold" },
26
26
  ),
@@ -19,8 +19,8 @@ module Plurimath
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag(intent, options:)
22
- Utility.update_nodes(
23
- Utility.ox_element(
22
+ XmlHelper.update_nodes(
23
+ XmlHelper.ox_element(
24
24
  "mstyle",
25
25
  attributes: { mathvariant: "double-struck" },
26
26
  ),
@@ -19,8 +19,8 @@ module Plurimath
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag(intent, options:)
22
- Utility.update_nodes(
23
- Utility.ox_element(
22
+ XmlHelper.update_nodes(
23
+ XmlHelper.ox_element(
24
24
  "mstyle",
25
25
  attributes: { mathvariant: "fraktur" },
26
26
  ),
@@ -19,8 +19,8 @@ module Plurimath
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag(intent, options:)
22
- Utility.update_nodes(
23
- Utility.ox_element(
22
+ XmlHelper.update_nodes(
23
+ XmlHelper.ox_element(
24
24
  "mstyle",
25
25
  attributes: { mathvariant: "italic" },
26
26
  ),
@@ -19,8 +19,8 @@ module Plurimath
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag(intent, options:)
22
- Utility.update_nodes(
23
- Utility.ox_element(
22
+ XmlHelper.update_nodes(
23
+ XmlHelper.ox_element(
24
24
  "mstyle",
25
25
  attributes: { mathvariant: "monospace" },
26
26
  ),
@@ -19,8 +19,8 @@ module Plurimath
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag(intent, options:)
22
- Utility.update_nodes(
23
- Utility.ox_element(
22
+ XmlHelper.update_nodes(
23
+ XmlHelper.ox_element(
24
24
  "mstyle",
25
25
  attributes: { mathvariant: "normal" },
26
26
  ),
@@ -19,8 +19,8 @@ module Plurimath
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag(intent, options:)
22
- Utility.update_nodes(
23
- Utility.ox_element(
22
+ XmlHelper.update_nodes(
23
+ XmlHelper.ox_element(
24
24
  "mstyle",
25
25
  attributes: { mathvariant: "sans-serif" },
26
26
  ),
@@ -19,8 +19,8 @@ module Plurimath
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag(intent, options:)
22
- Utility.update_nodes(
23
- Utility.ox_element(
22
+ XmlHelper.update_nodes(
23
+ XmlHelper.ox_element(
24
24
  "mstyle",
25
25
  attributes: { mathvariant: "script" },
26
26
  ),
@@ -33,8 +33,8 @@ module Plurimath
33
33
  def to_mathml_without_math_tag(intent, options:)
34
34
  first_value = parameter_one&.to_mathml_without_math_tag(intent,
35
35
  options: options)
36
- Utility.update_nodes(
37
- Utility.ox_element(
36
+ XmlHelper.update_nodes(
37
+ XmlHelper.ox_element(
38
38
  "mstyle",
39
39
  attributes: { mathvariant: font_family(mathml: true) },
40
40
  ),
@@ -63,7 +63,8 @@ module Plurimath
63
63
  end
64
64
 
65
65
  def extract_class_name_from_text
66
- parameter_one.parameter_one if parameter_one.is_a?(Text)
66
+ return parameter_one.parameter_one if parameter_one.is_a?(Text)
67
+
67
68
  parameter_one.class_name
68
69
  end
69
70
 
@@ -80,7 +81,7 @@ module Plurimath
80
81
 
81
82
  if children.all? { |node| node.is_a?(String) || t_tag_node?(node) }
82
83
  r_tag = empty_font_style_r_tag(sty, scr)
83
- Utility.update_nodes(r_tag, children)
84
+ XmlHelper.update_nodes(r_tag, children)
84
85
  return [r_tag]
85
86
  end
86
87
 
@@ -118,15 +119,15 @@ module Plurimath
118
119
  end
119
120
 
120
121
  def empty_font_style_r_tag(sty, scr)
121
- r_tag = Utility.ox_element("r", namespace: "m")
122
- rpr_tag = Utility.ox_element("rPr", namespace: "m")
122
+ r_tag = XmlHelper.ox_element("r", namespace: "m")
123
+ rpr_tag = XmlHelper.ox_element("rPr", namespace: "m")
123
124
  if scr
124
- rpr_tag << Utility.ox_element("scr", namespace: "m",
125
- attributes: { "m:val": scr })
125
+ rpr_tag << XmlHelper.ox_element("scr", namespace: "m",
126
+ attributes: { "m:val": scr })
126
127
  end
127
128
  if sty
128
- rpr_tag << Utility.ox_element("sty", namespace: "m",
129
- attributes: { "m:val": sty })
129
+ rpr_tag << XmlHelper.ox_element("sty", namespace: "m",
130
+ attributes: { "m:val": sty })
130
131
  end
131
132
  r_tag << rpr_tag
132
133
  r_tag
@@ -137,14 +138,14 @@ module Plurimath
137
138
  n.respond_to?(:name) && n.name == "m:rPr"
138
139
  end
139
140
 
140
- rpr_tag = Utility.ox_element("rPr", namespace: "m")
141
+ rpr_tag = XmlHelper.ox_element("rPr", namespace: "m")
141
142
  if scr
142
- rpr_tag << Utility.ox_element("scr", namespace: "m",
143
- attributes: { "m:val": scr })
143
+ rpr_tag << XmlHelper.ox_element("scr", namespace: "m",
144
+ attributes: { "m:val": scr })
144
145
  end
145
146
  if sty
146
- rpr_tag << Utility.ox_element("sty", namespace: "m",
147
- attributes: { "m:val": sty })
147
+ rpr_tag << XmlHelper.ox_element("sty", namespace: "m",
148
+ attributes: { "m:val": sty })
148
149
  end
149
150
  r_node.insert_in_nodes(0, rpr_tag)
150
151
  end
@@ -42,7 +42,7 @@ module Plurimath
42
42
  opt == :choose
43
43
  end)
44
44
  end
45
- Utility.update_nodes(frac_tag, mathml_value)
45
+ XmlHelper.update_nodes(frac_tag, mathml_value)
46
46
  if intent
47
47
  update_derivative(frac_tag, mathml_value[0],
48
48
  mathml_value[1])
@@ -57,8 +57,8 @@ module Plurimath
57
57
  end
58
58
 
59
59
  def to_omml_without_math_tag(display_style, options:)
60
- f_element = Utility.ox_element("f", namespace: "m")
61
- Utility.update_nodes(
60
+ f_element = XmlHelper.ox_element("f", namespace: "m")
61
+ XmlHelper.update_nodes(
62
62
  f_element,
63
63
  [
64
64
  fpr_element,
@@ -137,13 +137,13 @@ module Plurimath
137
137
  protected
138
138
 
139
139
  def fpr_element
140
- fpr_element = Utility.ox_element("fPr", namespace: "m")
140
+ fpr_element = XmlHelper.ox_element("fPr", namespace: "m")
141
141
  if options
142
142
  attributes = { "m:val": attr_value }
143
- fpr_element << Utility.ox_element("type", namespace: "m",
144
- attributes: attributes)
143
+ fpr_element << XmlHelper.ox_element("type", namespace: "m",
144
+ attributes: attributes)
145
145
  end
146
- fpr_element << Utility.pr_element("ctrl", true, namespace: "m")
146
+ fpr_element << XmlHelper.pr_element("ctrl", true, namespace: "m")
147
147
  end
148
148
 
149
149
  def attr_value
@@ -22,12 +22,12 @@ module Plurimath
22
22
  end
23
23
 
24
24
  def to_mathml_without_math_tag(intent, options:)
25
- mo_tag = (Utility.ox_element("mo") << "^")
25
+ mo_tag = (XmlHelper.ox_element("mo") << "^")
26
26
  return mo_tag unless parameter_one
27
27
 
28
- mover_tag = Utility.ox_element("mover")
28
+ mover_tag = XmlHelper.ox_element("mover")
29
29
  mover_tag.set_attr(attributes) if attributes && !attributes.empty?
30
- Utility.update_nodes(
30
+ XmlHelper.update_nodes(
31
31
  mover_tag,
32
32
  [
33
33
  parameter_one&.to_mathml_without_math_tag(intent,
@@ -75,11 +75,11 @@ module Plurimath
75
75
 
76
76
  def accent_tag(display_style, options:)
77
77
  symbol = "̂" unless hide_function_name
78
- acc_tag = Utility.ox_element("acc", namespace: "m")
79
- acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
80
- acc_pr_tag << Utility.ox_element("chr", namespace: "m",
81
- attributes: { "m:val": symbol })
82
- Utility.update_nodes(
78
+ acc_tag = XmlHelper.ox_element("acc", namespace: "m")
79
+ acc_pr_tag = XmlHelper.ox_element("accPr", namespace: "m")
80
+ acc_pr_tag << XmlHelper.ox_element("chr", namespace: "m",
81
+ attributes: { "m:val": symbol })
82
+ XmlHelper.update_nodes(
83
83
  acc_tag,
84
84
  [
85
85
  acc_pr_tag,
@@ -17,7 +17,7 @@ module Plurimath
17
17
  end
18
18
 
19
19
  def to_mathml_without_math_tag(intent, options:)
20
- first_value = Utility.ox_element("mo") << class_name
20
+ first_value = XmlHelper.ox_element("mo") << class_name
21
21
  return first_value unless any_value_exist?
22
22
 
23
23
  tag_name = if parameter_two && parameter_one
@@ -26,7 +26,7 @@ module Plurimath
26
26
  parameter_one ? "under" : "over"
27
27
  end
28
28
  inf_tag = ox_element("m#{tag_name}")
29
- Utility.update_nodes(
29
+ XmlHelper.update_nodes(
30
30
  inf_tag,
31
31
  [
32
32
  first_value,
@@ -44,11 +44,11 @@ module Plurimath
44
44
  end
45
45
 
46
46
  def to_mathml_without_math_tag(intent, options:)
47
- base_element = (Utility.ox_element("mo") << invert_unicode_symbols.to_s)
47
+ base_element = (XmlHelper.ox_element("mo") << invert_unicode_symbols.to_s)
48
48
  return base_element unless any_value_exist?
49
49
 
50
- msubsup_tag = Utility.ox_element("msubsup")
51
- Utility.update_nodes(
50
+ msubsup_tag = XmlHelper.ox_element("msubsup")
51
+ XmlHelper.update_nodes(
52
52
  msubsup_tag,
53
53
  [
54
54
  base_element,
@@ -60,7 +60,7 @@ module Plurimath
60
60
  return msubsup_tag if parameter_three.nil?
61
61
 
62
62
  mrow = ox_element("mrow")
63
- Utility.update_nodes(
63
+ XmlHelper.update_nodes(
64
64
  mrow,
65
65
  [
66
66
  msubsup_tag,
@@ -76,13 +76,13 @@ module Plurimath
76
76
 
77
77
  def to_omml_without_math_tag(display_style, options:)
78
78
  if any_value_exist?
79
- nary = Utility.ox_element("nary", namespace: "m")
80
- Utility.update_nodes(nary,
79
+ nary = XmlHelper.ox_element("nary", namespace: "m")
80
+ XmlHelper.update_nodes(nary,
81
81
  nary_array(display_style, options: options))
82
82
  [nary]
83
83
  else
84
- r_tag = Utility.ox_element("r", namespace: "m")
85
- t_tag = Utility.ox_element("t", namespace: "m")
84
+ r_tag = XmlHelper.ox_element("r", namespace: "m")
85
+ t_tag = XmlHelper.ox_element("t", namespace: "m")
86
86
  r_tag << (t_tag << "&#x222b;")
87
87
  [r_tag]
88
88
  end
@@ -9,15 +9,15 @@ module Plurimath
9
9
  end
10
10
 
11
11
  def to_mathml_without_math_tag(_intent, **)
12
- mo = Utility.ox_element("mo")
12
+ mo = XmlHelper.ox_element("mo")
13
13
  mo << left_paren if parameter_one
14
14
  mo
15
15
  end
16
16
 
17
17
  def to_omml_without_math_tag(_, **)
18
- mr = Utility.ox_element("m:r")
18
+ mr = XmlHelper.ox_element("m:r")
19
19
  if parameter_one
20
- mt = Utility.ox_element("m:t")
20
+ mt = XmlHelper.ox_element("m:t")
21
21
  mr << (mt << parameter_one)
22
22
  end
23
23
  [mr]
@@ -48,12 +48,12 @@ module Plurimath
48
48
  end
49
49
 
50
50
  def to_mathml_math_zone(spacing = "", _, _, **)
51
- mo_tag = (Utility.ox_element("mo") << left_paren)
51
+ mo_tag = (XmlHelper.ox_element("mo") << left_paren)
52
52
  "#{spacing}\"#{dump_ox_nodes(mo_tag).gsub(/\s+/, '')}\" left\n"
53
53
  end
54
54
 
55
55
  def to_omml_math_zone(spacing = "", _, _, display_style:, **)
56
- t_tag = (Utility.ox_element("t", namespace: "m") << left_paren)
56
+ t_tag = (XmlHelper.ox_element("t", namespace: "m") << left_paren)
57
57
  "#{spacing}\"#{dump_ox_nodes(t_tag).gsub(/\s+/, '')}\" left\n"
58
58
  end
59
59
 
@@ -35,7 +35,7 @@ module Plurimath
35
35
  end
36
36
 
37
37
  def to_mathml_without_math_tag(intent, options:)
38
- first_value = Utility.ox_element("mo") << "lim"
38
+ first_value = XmlHelper.ox_element("mo") << "lim"
39
39
  return first_value unless any_value_exist?
40
40
 
41
41
  tag_name = if parameter_two && parameter_one
@@ -43,8 +43,8 @@ module Plurimath
43
43
  else
44
44
  parameter_one ? "under" : "over"
45
45
  end
46
- lim_tag = Utility.ox_element("m#{tag_name}")
47
- Utility.update_nodes(
46
+ lim_tag = XmlHelper.ox_element("m#{tag_name}")
47
+ XmlHelper.update_nodes(
48
48
  lim_tag,
49
49
  [
50
50
  first_value,
@@ -12,13 +12,13 @@ module Plurimath
12
12
  }.freeze
13
13
 
14
14
  def to_mathml_without_math_tag(intent, options:)
15
- underover = Utility.ox_element("munderover")
15
+ underover = XmlHelper.ox_element("munderover")
16
16
  value_array = [
17
17
  validate_mathml_fields(parameter_one, intent, options: options),
18
18
  validate_mathml_fields(parameter_two, intent, options: options),
19
19
  validate_mathml_fields(parameter_three, intent, options: options),
20
20
  ]
21
- Utility.update_nodes(underover, value_array)
21
+ XmlHelper.update_nodes(underover, value_array)
22
22
  end
23
23
 
24
24
  def to_latex(options:)
@@ -9,7 +9,7 @@ module Plurimath
9
9
  def initialize(parameter_one = nil, attributes = {})
10
10
  @parameter_one = parameter_one
11
11
  @attributes = attributes
12
- Utility.validate_left_right([parameter_one])
12
+ ModelHelper.validate_left_right([parameter_one])
13
13
  end
14
14
 
15
15
  def ==(object)
@@ -44,7 +44,7 @@ module Plurimath
44
44
 
45
45
  def to_mathml_without_math_tag(intent, options:)
46
46
  unless parameter_one
47
- return Utility.ox_element("mo",
47
+ return XmlHelper.ox_element("mo",
48
48
  attributes: { linebreak: "newline" })
49
49
  end
50
50
 
@@ -62,10 +62,10 @@ module Plurimath
62
62
  def to_omml_without_math_tag(display_style, options:)
63
63
  return r_element("log", rpr_tag: false) unless any_value_exist?
64
64
 
65
- ssubsup = Utility.ox_element("sSubSup", namespace: "m")
66
- ssubsuppr = Utility.ox_element("sSubSupPr", namespace: "m")
67
- ssubsuppr << Utility.pr_element("ctrl", true, namespace: "m")
68
- Utility.update_nodes(
65
+ ssubsup = XmlHelper.ox_element("sSubSup", namespace: "m")
66
+ ssubsuppr = XmlHelper.ox_element("sSubSupPr", namespace: "m")
67
+ ssubsuppr << XmlHelper.pr_element("ctrl", true, namespace: "m")
68
+ XmlHelper.update_nodes(
69
69
  ssubsup,
70
70
  [
71
71
  ssubsuppr,
@@ -94,7 +94,7 @@ module Plurimath
94
94
  validate_mathml_fields(parameter_one, intent, options: options),
95
95
  validate_mathml_fields(parameter_two, intent, options: options),
96
96
  ]
97
- Utility.update_nodes(ox_element("m#{tag_name}"), new_arr)
97
+ XmlHelper.update_nodes(ox_element("m#{tag_name}"), new_arr)
98
98
  end
99
99
 
100
100
  def to_unicodemath(options:)
@@ -117,18 +117,18 @@ module Plurimath
117
117
  protected
118
118
 
119
119
  def e_parameter
120
- e_tag = Utility.ox_element("e", namespace: "m")
120
+ e_tag = XmlHelper.ox_element("e", namespace: "m")
121
121
  return e_tag if hide_function_name
122
122
 
123
123
  e_tag << rpr_tag
124
124
  end
125
125
 
126
126
  def rpr_tag
127
- rpr_tag = (Utility.ox_element("rPr",
127
+ rpr_tag = (XmlHelper.ox_element("rPr",
128
128
  namespace: "m") << msty_tag_with_attrs)
129
- r_tag = Utility.ox_element("r", namespace: "m")
130
- t_tag = (Utility.ox_element("t", namespace: "m") << "log")
131
- Utility.update_nodes(r_tag, [rpr_tag, t_tag])
129
+ r_tag = XmlHelper.ox_element("r", namespace: "m")
130
+ t_tag = (XmlHelper.ox_element("t", namespace: "m") << "log")
131
+ XmlHelper.update_nodes(r_tag, [rpr_tag, t_tag])
132
132
  end
133
133
 
134
134
  def sup_value(options:)