plurimath 0.11.6 → 0.11.8

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 +5 -0
  112. metadata +24 -2
@@ -17,7 +17,7 @@ module Plurimath
17
17
  end
18
18
 
19
19
  def to_mathml_without_math_tag(intent, options:)
20
- Utility.update_nodes(
20
+ XmlHelper.update_nodes(
21
21
  ox_element("mover"),
22
22
  [
23
23
  mathml_values(parameter_two, intent, options: options),
@@ -33,10 +33,10 @@ module Plurimath
33
33
  end
34
34
 
35
35
  def to_omml_without_math_tag(display_style, options:)
36
- limupp = Utility.ox_element("limUpp", namespace: "m")
37
- limupppr = Utility.ox_element("limUppPr", namespace: "m")
38
- limupppr << Utility.pr_element("ctrl", true, namespace: "m")
39
- Utility.update_nodes(
36
+ limupp = XmlHelper.ox_element("limUpp", namespace: "m")
37
+ limupppr = XmlHelper.ox_element("limUppPr", namespace: "m")
38
+ limupppr << XmlHelper.pr_element("ctrl", true, namespace: "m")
39
+ XmlHelper.update_nodes(
40
40
  limupp,
41
41
  [
42
42
  limupppr,
@@ -23,7 +23,7 @@ module Plurimath
23
23
  end
24
24
 
25
25
  def to_mathml_without_math_tag(intent, options:)
26
- Utility.update_nodes(
26
+ XmlHelper.update_nodes(
27
27
  ox_element("mtable"),
28
28
  mathml_value(intent, options: options),
29
29
  )
@@ -58,7 +58,7 @@ module Plurimath
58
58
  first_value << invert_unicode_symbols.to_s unless hide_function_name
59
59
  return first_value unless any_value_exist?
60
60
 
61
- munderover_tag = Utility.update_nodes(
61
+ munderover_tag = XmlHelper.update_nodes(
62
62
  sum_tag,
63
63
  [
64
64
  first_value,
@@ -71,7 +71,7 @@ module Plurimath
71
71
  return munderover_tag if parameter_three.nil?
72
72
 
73
73
  mrow = ox_element("mrow")
74
- Utility.update_nodes(
74
+ XmlHelper.update_nodes(
75
75
  mrow,
76
76
  [
77
77
  munderover_tag,
@@ -108,8 +108,8 @@ module Plurimath
108
108
  def to_omml_without_math_tag(display_style, options:)
109
109
  return r_element("&#x2211;", rpr_tag: false) unless any_value_exist?
110
110
 
111
- nary = Utility.ox_element("nary", namespace: "m")
112
- Utility.update_nodes(
111
+ nary = XmlHelper.ox_element("nary", namespace: "m")
112
+ XmlHelper.update_nodes(
113
113
  nary,
114
114
  [
115
115
  narypr(hide_function_name ? "" : "∑"),
@@ -11,7 +11,7 @@ module Plurimath
11
11
  first_value = mathml_value(intent, options: options)&.insert(0,
12
12
  mo_tag)
13
13
  end
14
- Utility.update_nodes(
14
+ XmlHelper.update_nodes(
15
15
  ox_element("mrow"),
16
16
  first_value,
17
17
  )
@@ -17,7 +17,7 @@ module Plurimath
17
17
  end
18
18
 
19
19
  def to_mathml_without_math_tag(intent, options:)
20
- Utility.update_nodes(
20
+ XmlHelper.update_nodes(
21
21
  ox_element("mtable", attributes: attributes(intent)),
22
22
  value&.map do |object|
23
23
  object&.to_mathml_without_math_tag(intent, options: options)
@@ -22,13 +22,13 @@ module Plurimath
22
22
  table_tag["intent"] =
23
23
  ":matrix(#{value.length},#{td_count})"
24
24
  end
25
- Utility.update_nodes(
25
+ XmlHelper.update_nodes(
26
26
  table_tag,
27
27
  value&.map do |object|
28
28
  object&.to_mathml_without_math_tag(intent, options: options)
29
29
  end,
30
30
  )
31
- Utility.update_nodes(
31
+ XmlHelper.update_nodes(
32
32
  ox_element("mrow", attributes: intent_attr(intent)),
33
33
  [
34
34
  mo_element(mathml_parenthesis(open_paren, intent,
@@ -24,7 +24,7 @@ module Plurimath
24
24
  end
25
25
 
26
26
  def to_mathml_without_math_tag(intent, options:)
27
- table_tag = Utility.update_nodes(
27
+ table_tag = XmlHelper.update_nodes(
28
28
  ox_element("mtable", attributes: table_attribute),
29
29
  value&.map do |object|
30
30
  object&.to_mathml_without_math_tag(intent, options: options)
@@ -32,7 +32,7 @@ module Plurimath
32
32
  )
33
33
  return table_tag if table_tag_only?
34
34
 
35
- Utility.update_nodes(
35
+ XmlHelper.update_nodes(
36
36
  ox_element("mrow"),
37
37
  [mo_tag(open_paren), table_tag, mo_tag(close_paren)],
38
38
  )
@@ -52,7 +52,7 @@ module Plurimath
52
52
  def to_mathml_without_math_tag(intent, options:)
53
53
  table_tag = ox_element("mtable", attributes: table_attribute)
54
54
  table_tag["intent"] = ":matrix(#{value.length},#{td_count})" if intent
55
- Utility.update_nodes(
55
+ XmlHelper.update_nodes(
56
56
  table_tag,
57
57
  value&.map do |object|
58
58
  object&.to_mathml_without_math_tag(intent, options: options)
@@ -69,7 +69,7 @@ module Plurimath
69
69
  options: options))
70
70
  attributes = { intent: ":fenced" } if intent
71
71
  mrow = ox_element("mrow", attributes: attributes)
72
- return Utility.update_nodes(mrow,
72
+ return XmlHelper.update_nodes(mrow,
73
73
  [first_paren, table_tag, second_paren])
74
74
  end
75
75
 
@@ -284,37 +284,37 @@ options:)
284
284
  end
285
285
 
286
286
  def single_td_table(display_style, options:)
287
- eqarr = Utility.ox_element("eqArr", namespace: "m")
288
- eqarrpr = Utility.ox_element("eqArrPr", namespace: "m")
289
- eqarrpr << Utility.pr_element("ctrl", true, namespace: "m")
287
+ eqarr = XmlHelper.ox_element("eqArr", namespace: "m")
288
+ eqarrpr = XmlHelper.ox_element("eqArrPr", namespace: "m")
289
+ eqarrpr << XmlHelper.pr_element("ctrl", true, namespace: "m")
290
290
  eqarr << eqarrpr
291
291
  tr_value = value.map do |object|
292
292
  object.to_omml_without_math_tag(display_style, options: options)
293
293
  end.flatten
294
- Utility.update_nodes(eqarr, tr_value.compact)
294
+ XmlHelper.update_nodes(eqarr, tr_value.compact)
295
295
  [eqarr]
296
296
  end
297
297
 
298
298
  def multiple_td_table(display_style, options:)
299
299
  count = { "m:val": value&.first&.parameter_one&.count }
300
300
  mcjc = { "m:val": "center" }
301
- mm = Utility.ox_element("m", namespace: "m")
302
- mpr = Utility.ox_element("mPr", namespace: "m")
303
- mcs = Utility.ox_element("mcs", namespace: "m")
304
- mc = Utility.ox_element("mc", namespace: "m")
305
- mcpr = Utility.ox_element("mcPr", namespace: "m")
306
- mcount = Utility.ox_element(
301
+ mm = XmlHelper.ox_element("m", namespace: "m")
302
+ mpr = XmlHelper.ox_element("mPr", namespace: "m")
303
+ mcs = XmlHelper.ox_element("mcs", namespace: "m")
304
+ mc = XmlHelper.ox_element("mc", namespace: "m")
305
+ mcpr = XmlHelper.ox_element("mcPr", namespace: "m")
306
+ mcount = XmlHelper.ox_element(
307
307
  "count",
308
308
  namespace: "m",
309
309
  attributes: count,
310
310
  )
311
- mcjc = Utility.ox_element(
311
+ mcjc = XmlHelper.ox_element(
312
312
  "mcJc",
313
313
  namespace: "m",
314
314
  attributes: mcjc,
315
315
  )
316
- ctrlpr = Utility.pr_element("ctrl", true, namespace: "m")
317
- Utility.update_nodes(mcpr, [mcount, mcjc])
316
+ ctrlpr = XmlHelper.pr_element("ctrl", true, namespace: "m")
317
+ XmlHelper.update_nodes(mcpr, [mcount, mcjc])
318
318
  mc << mcpr
319
319
  mcs << mc
320
320
  mpr << mcs
@@ -322,7 +322,7 @@ options:)
322
322
  mm_value = value&.map do |object|
323
323
  object.to_omml_without_math_tag(display_style, options: options)
324
324
  end
325
- Utility.update_nodes(
325
+ XmlHelper.update_nodes(
326
326
  mm,
327
327
  mm_value.insert(0, mpr).flatten,
328
328
  )
@@ -330,7 +330,7 @@ options:)
330
330
  end
331
331
 
332
332
  def norm_table(table_tag)
333
- Utility.update_nodes(
333
+ XmlHelper.update_nodes(
334
334
  ox_element("mrow"),
335
335
  [
336
336
  mo_element("&#x2016;"),
@@ -343,32 +343,32 @@ options:)
343
343
  def fenced_table(ox_table)
344
344
  return ox_table unless open_paren || close_paren
345
345
 
346
- d_node = Utility.ox_element("d", namespace: "m")
347
- e_node = Utility.ox_element("e", namespace: "m")
348
- Utility.update_nodes(e_node, ox_table)
349
- Utility.update_nodes(d_node, [mdpr_node, e_node])
346
+ d_node = XmlHelper.ox_element("d", namespace: "m")
347
+ e_node = XmlHelper.ox_element("e", namespace: "m")
348
+ XmlHelper.update_nodes(e_node, ox_table)
349
+ XmlHelper.update_nodes(d_node, [mdpr_node, e_node])
350
350
  [d_node]
351
351
  end
352
352
 
353
353
  def mdpr_node
354
- sepchr = Utility.ox_element("sepChr", attributes: { "m:val": "" },
355
- namespace: "m")
356
- mgrow = Utility.ox_element("grow", namespace: "m")
357
- mdpr = Utility.ox_element("dPr", namespace: "m")
358
- Utility.update_nodes(mdpr, [begchr, endchr, sepchr, mgrow])
354
+ sepchr = XmlHelper.ox_element("sepChr", attributes: { "m:val": "" },
355
+ namespace: "m")
356
+ mgrow = XmlHelper.ox_element("grow", namespace: "m")
357
+ mdpr = XmlHelper.ox_element("dPr", namespace: "m")
358
+ XmlHelper.update_nodes(mdpr, [begchr, endchr, sepchr, mgrow])
359
359
  end
360
360
 
361
361
  def begchr
362
362
  return unless open_paren
363
363
 
364
- Utility.ox_element("begChr",
364
+ XmlHelper.ox_element("begChr",
365
365
  attributes: { "m:val": paren(open_paren) }, namespace: "m")
366
366
  end
367
367
 
368
368
  def endchr
369
369
  return unless close_paren
370
370
 
371
- Utility.ox_element("endChr",
371
+ XmlHelper.ox_element("endChr",
372
372
  attributes: { "m:val": paren(close_paren) }, namespace: "m")
373
373
  end
374
374
 
@@ -400,7 +400,7 @@ options:)
400
400
  end
401
401
 
402
402
  def mo_element(value)
403
- Utility.ox_element("mo") << value
403
+ XmlHelper.ox_element("mo") << value
404
404
  end
405
405
 
406
406
  def unicodemath_table_class?
@@ -19,7 +19,7 @@ module Plurimath
19
19
  return "" if Utility.symbol_value(parameter_one.first, "|")
20
20
 
21
21
  td_attribute = parameter_two if parameter_two&.any?
22
- Utility.update_nodes(
22
+ XmlHelper.update_nodes(
23
23
  ox_element("mtd", attributes: td_attribute),
24
24
  parameter_one.map do |object|
25
25
  object&.to_mathml_without_math_tag(intent, options: options)
@@ -41,10 +41,10 @@ module Plurimath
41
41
  end
42
42
 
43
43
  def to_omml_without_math_tag(display_style, options:)
44
- me = Utility.ox_element("e", namespace: "m")
44
+ me = XmlHelper.ox_element("e", namespace: "m")
45
45
  return [me] if parameter_one && parameter_one.empty?
46
46
 
47
- Utility.update_nodes(me,
47
+ XmlHelper.update_nodes(me,
48
48
  omml_content(display_style, options: options))
49
49
  [me]
50
50
  end
@@ -13,7 +13,7 @@ module Plurimath
13
13
  @parameter_one = parameter_one
14
14
  @parameter_two = parameter_two
15
15
  @parameter_three = parameter_three
16
- Utility.validate_left_right(variables.map { |var| get(var) })
16
+ ModelHelper.validate_left_right(variables.map { |var| get(var) })
17
17
  end
18
18
 
19
19
  def ==(object)
@@ -46,7 +46,7 @@ module Plurimath
46
46
  validate_mathml_fields(parameter_three, intent, options: options),
47
47
  ]
48
48
  class_tag = ox_element("m#{class_name}")
49
- Utility.update_nodes(class_tag, value_arr)
49
+ XmlHelper.update_nodes(class_tag, value_arr)
50
50
  end
51
51
 
52
52
  def to_latex(options:)
@@ -214,16 +214,16 @@ options:)
214
214
  limloc_arg = { "m:val": function_type }
215
215
  subhide_arg = { "m:val": parameter_one ? "0" : "1" }
216
216
  suphide_arg = { "m:val": parameter_two ? "0" : "1" }
217
- chr_tag = Utility.ox_element("chr", attributes: chr_arg,
218
- namespace: "m")
219
- limloc_tag = Utility.ox_element("limLoc", attributes: limloc_arg,
220
- namespace: "m")
221
- subhide_tag = Utility.ox_element("subHide", attributes: subhide_arg,
222
- namespace: "m")
223
- suphide_tag = Utility.ox_element("supHide", attributes: suphide_arg,
224
- namespace: "m")
225
- nary_pr_tag = Utility.ox_element("naryPr", namespace: "m")
226
- Utility.update_nodes(
217
+ chr_tag = XmlHelper.ox_element("chr", attributes: chr_arg,
218
+ namespace: "m")
219
+ limloc_tag = XmlHelper.ox_element("limLoc", attributes: limloc_arg,
220
+ namespace: "m")
221
+ subhide_tag = XmlHelper.ox_element("subHide", attributes: subhide_arg,
222
+ namespace: "m")
223
+ suphide_tag = XmlHelper.ox_element("supHide", attributes: suphide_arg,
224
+ namespace: "m")
225
+ nary_pr_tag = XmlHelper.ox_element("naryPr", namespace: "m")
226
+ XmlHelper.update_nodes(
227
227
  nary_pr_tag,
228
228
  [
229
229
  chr_tag,
@@ -235,7 +235,7 @@ options:)
235
235
  end
236
236
 
237
237
  def validate_mathml_tag(parameter, intent, options:)
238
- return Array(Utility.ox_element("mrow")) unless parameter
238
+ return Array(XmlHelper.ox_element("mrow")) unless parameter
239
239
 
240
240
  Array(parameter.to_mathml_without_math_tag(intent, options: options))
241
241
  end
@@ -37,7 +37,7 @@ module Plurimath
37
37
  end
38
38
 
39
39
  def to_omml_without_math_tag(_, **)
40
- text = Utility.ox_element("t", namespace: "m")
40
+ text = XmlHelper.ox_element("t", namespace: "m")
41
41
  text << (parse_text("omml") || parameter_one)
42
42
  [text]
43
43
  end
@@ -49,13 +49,13 @@ module Plurimath
49
49
  end
50
50
 
51
51
  def insert_t_tag(display_style, options:)
52
- r_tag = Utility.ox_element("r", namespace: "m")
52
+ r_tag = XmlHelper.ox_element("r", namespace: "m")
53
53
  if @lang&.to_s != "omml"
54
- rpr_tag = Utility.ox_element("rPr", namespace: "m")
54
+ rpr_tag = XmlHelper.ox_element("rPr", namespace: "m")
55
55
  rpr_tag << msty_tag_with_attrs
56
56
  r_tag << rpr_tag
57
57
  end
58
- Utility.update_nodes(
58
+ XmlHelper.update_nodes(
59
59
  r_tag,
60
60
  [omml_nodes(display_style, options: options)],
61
61
  )
@@ -18,7 +18,7 @@ module Plurimath
18
18
  second_value = parameter_one.to_mathml_without_math_tag(intent,
19
19
  options: options)
20
20
  end
21
- Utility.update_nodes(mover, [second_value, ox_element("mo") << "~"])
21
+ XmlHelper.update_nodes(mover, [second_value, ox_element("mo") << "~"])
22
22
  end
23
23
 
24
24
  def to_omml_without_math_tag(display_style, options:)
@@ -53,11 +53,11 @@ module Plurimath
53
53
  protected
54
54
 
55
55
  def acc_tag(display_style, options:)
56
- acc_tag = Utility.ox_element("acc", namespace: "m")
57
- acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
58
- acc_pr_tag << Utility.ox_element("chr", namespace: "m",
59
- attributes: { "m:val": "˜" })
60
- Utility.update_nodes(
56
+ acc_tag = XmlHelper.ox_element("acc", namespace: "m")
57
+ acc_pr_tag = XmlHelper.ox_element("accPr", namespace: "m")
58
+ acc_pr_tag << XmlHelper.ox_element("chr", namespace: "m",
59
+ attributes: { "m:val": "˜" })
60
+ XmlHelper.update_nodes(
61
61
  acc_tag,
62
62
  [
63
63
  acc_pr_tag,
@@ -22,8 +22,8 @@ module Plurimath
22
22
 
23
23
  def to_mathml_without_math_tag(intent, options:)
24
24
  first_value = remove_hline(cloned_objects.parameter_one)
25
- Utility.update_nodes(
26
- Utility.ox_element("mtr"),
25
+ XmlHelper.update_nodes(
26
+ XmlHelper.ox_element("mtr"),
27
27
  first_value.filter_map do |obj|
28
28
  obj&.to_mathml_without_math_tag(intent, options: options)
29
29
  end,
@@ -53,8 +53,8 @@ module Plurimath
53
53
  if parameter_one.count.eql?(1)
54
54
  omml_content
55
55
  else
56
- mr = Utility.ox_element("mr", namespace: "m")
57
- Utility.update_nodes(
56
+ mr = XmlHelper.ox_element("mr", namespace: "m")
57
+ XmlHelper.update_nodes(
58
58
  mr,
59
59
  omml_content,
60
60
  )
@@ -27,7 +27,7 @@ module Plurimath
27
27
 
28
28
  over_tag = ox_element("munder")
29
29
  over_tag.set_attr(attributes) if attributes && !attributes.empty?
30
- Utility.update_nodes(
30
+ XmlHelper.update_nodes(
31
31
  over_tag,
32
32
  [
33
33
  parameter_one.to_mathml_without_math_tag(intent,
@@ -27,7 +27,7 @@ module Plurimath
27
27
 
28
28
  munder_tag = ox_element("munder")
29
29
  munder_tag.set_attr(attributes) if attributes && !attributes.empty?
30
- Utility.update_nodes(
30
+ XmlHelper.update_nodes(
31
31
  munder_tag,
32
32
  [
33
33
  parameter_one&.to_mathml_without_math_tag(intent,
@@ -68,14 +68,14 @@ module Plurimath
68
68
  protected
69
69
 
70
70
  def groupchr_tag(display_style, options:)
71
- groupchr = Utility.ox_element("groupChr", namespace: "m")
72
- groupchrpr = Utility.ox_element("groupChrPR", namespace: "m")
73
- chr = Utility.ox_element("chr", namespace: "m",
74
- attributes: { "m:val": "_" })
75
- pos = Utility.ox_element("pos", namespace: "m",
76
- attributes: { "m:val": "bot" })
77
- Utility.update_nodes(groupchrpr, [chr, pos])
78
- Utility.update_nodes(
71
+ groupchr = XmlHelper.ox_element("groupChr", namespace: "m")
72
+ groupchrpr = XmlHelper.ox_element("groupChrPR", namespace: "m")
73
+ chr = XmlHelper.ox_element("chr", namespace: "m",
74
+ attributes: { "m:val": "_" })
75
+ pos = XmlHelper.ox_element("pos", namespace: "m",
76
+ attributes: { "m:val": "bot" })
77
+ XmlHelper.update_nodes(groupchrpr, [chr, pos])
78
+ XmlHelper.update_nodes(
79
79
  groupchr,
80
80
  [
81
81
  groupchrpr,
@@ -10,7 +10,7 @@ module Plurimath
10
10
  parameter_one = parameter_one.to_s if parameter_one.is_a?(Parslet::Slice)
11
11
  @parameter_one = parameter_one
12
12
  method(:post_initialize).call if methods.include?(:post_initialize)
13
- Utility.validate_left_right(variables.map { |var| get(var) })
13
+ ModelHelper.validate_left_right(variables.map { |var| get(var) })
14
14
  end
15
15
 
16
16
  def ==(object)
@@ -39,14 +39,14 @@ module Plurimath
39
39
  unary_element = if parameter_one
40
40
  new_arr += mathml_value(intent, options: options)
41
41
  mrow = ox_element("mrow")
42
- Utility.update_nodes(mrow, new_arr)
42
+ XmlHelper.update_nodes(mrow, new_arr)
43
43
  intentify(mrow, intent, func_name: :function,
44
44
  intent_name: intent_names[:name])
45
45
  else
46
46
  new_arr.first
47
47
  end
48
48
  if insert_space_tags && options[:unary_function_spacing]
49
- Utility.update_nodes(
49
+ XmlHelper.update_nodes(
50
50
  ox_element("mrow"),
51
51
  [
52
52
  ox_element("mo", attributes: { rspace: "thickmathspace" }),
@@ -79,8 +79,8 @@ module Plurimath
79
79
  if @hide_function_name
80
80
  value = omml_value(display_style, options: options)
81
81
  else
82
- func = Utility.ox_element("func", namespace: "m")
83
- value = Utility.update_nodes(func,
82
+ func = XmlHelper.ox_element("func", namespace: "m")
83
+ value = XmlHelper.update_nodes(func,
84
84
  function_values(display_style,
85
85
  options: options))
86
86
  end
@@ -252,19 +252,19 @@ options:)
252
252
  end
253
253
 
254
254
  def function_values(display_style, options:)
255
- funcpr = Utility.ox_element("funcPr", namespace: "m")
256
- funcpr << Utility.pr_element("ctrl", true, namespace: "m")
257
- fname = Utility.ox_element("fName", namespace: "m")
258
- fname << Utility.update_nodes(
259
- Utility.ox_element("r", namespace: "m"),
255
+ funcpr = XmlHelper.ox_element("funcPr", namespace: "m")
256
+ funcpr << XmlHelper.pr_element("ctrl", true, namespace: "m")
257
+ fname = XmlHelper.ox_element("fName", namespace: "m")
258
+ fname << XmlHelper.update_nodes(
259
+ XmlHelper.ox_element("r", namespace: "m"),
260
260
  [
261
- Utility.rpr_element,
262
- (Utility.ox_element("t", namespace: "m") << class_name),
261
+ XmlHelper.rpr_element,
262
+ (XmlHelper.ox_element("t", namespace: "m") << class_name),
263
263
  ],
264
264
  )
265
- me = Utility.ox_element("e", namespace: "m")
265
+ me = XmlHelper.ox_element("e", namespace: "m")
266
266
  if parameter_one
267
- Utility.update_nodes(me,
267
+ XmlHelper.update_nodes(me,
268
268
  omml_value(display_style,
269
269
  options: options))
270
270
  end
@@ -44,7 +44,7 @@ module Plurimath
44
44
  end
45
45
 
46
46
  def to_mathml_without_math_tag(intent, options:)
47
- Utility.update_nodes(
47
+ XmlHelper.update_nodes(
48
48
  ox_element("m#{class_name}"),
49
49
  [
50
50
  validate_mathml_fields(parameter_one, intent, options: options),
@@ -26,7 +26,7 @@ module Plurimath
26
26
  validate_mathml_fields(parameter_two, intent, options: options),
27
27
  validate_mathml_fields(parameter_one, intent, options: options),
28
28
  ]
29
- Utility.update_nodes(ox_element("munder", attributes: self.options),
29
+ XmlHelper.update_nodes(ox_element("munder", attributes: self.options),
30
30
  value_array)
31
31
  end
32
32
 
@@ -41,10 +41,10 @@ module Plurimath
41
41
  return group_chr(display_style, options: options)
42
42
  end
43
43
 
44
- limlow = Utility.ox_element("limLow", namespace: "m")
45
- limlowpr = Utility.ox_element("limLowPr", namespace: "m")
46
- limlowpr << Utility.pr_element("ctrl", true, namespace: "m")
47
- Utility.update_nodes(
44
+ limlow = XmlHelper.ox_element("limLow", namespace: "m")
45
+ limlowpr = XmlHelper.ox_element("limLowPr", namespace: "m")
46
+ limlowpr << XmlHelper.pr_element("ctrl", true, namespace: "m")
47
+ XmlHelper.update_nodes(
48
48
  limlow,
49
49
  [
50
50
  limlowpr,
@@ -58,15 +58,15 @@ module Plurimath
58
58
  end
59
59
 
60
60
  def group_chr(display_style, options:)
61
- groupchr = Utility.ox_element("groupChr", namespace: "m")
62
- groupchrpr = Utility.ox_element("groupChrPR", namespace: "m")
63
- chr = Utility.ox_element("chr", namespace: "m",
64
- attributes: { "m:val" => "_" })
65
- pos = Utility.ox_element("pos", namespace: "m",
66
- attributes: { "m:val" => "bot" })
61
+ groupchr = XmlHelper.ox_element("groupChr", namespace: "m")
62
+ groupchrpr = XmlHelper.ox_element("groupChrPR", namespace: "m")
63
+ chr = XmlHelper.ox_element("chr", namespace: "m",
64
+ attributes: { "m:val" => "_" })
65
+ pos = XmlHelper.ox_element("pos", namespace: "m",
66
+ attributes: { "m:val" => "bot" })
67
67
  groupchrpr << chr
68
68
  groupchrpr << pos
69
- Utility.update_nodes(
69
+ XmlHelper.update_nodes(
70
70
  groupchr,
71
71
  [
72
72
  groupchrpr,
@@ -98,7 +98,7 @@ options:)
98
98
  ))}</mrow>")
99
99
  xref = xml.nodes.find { |node| node.respond_to?(:[]) }&.[](:id)
100
100
  mathml[:xref] = xref if xref
101
- Utility.update_nodes(mathml, xml.nodes)
101
+ XmlHelper.update_nodes(mathml, xml.nodes)
102
102
  end
103
103
  end
104
104
  end
@@ -19,11 +19,11 @@ module Plurimath
19
19
  mover[:accent] =
20
20
  attributes[:accent]
21
21
  end
22
- Utility.update_nodes(
22
+ XmlHelper.update_nodes(
23
23
  mover,
24
24
  [
25
25
  first_value,
26
- Utility.ox_element("mo") << "&#x2192;",
26
+ XmlHelper.ox_element("mo") << "&#x2192;",
27
27
  ],
28
28
  )
29
29
  end
@@ -106,11 +106,11 @@ options:)
106
106
  protected
107
107
 
108
108
  def acc_tag(display_style, options:)
109
- acc_tag = Utility.ox_element("acc", namespace: "m")
110
- acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
111
- acc_pr_tag << Utility.ox_element("chr", namespace: "m",
112
- attributes: { "m:val": "→" })
113
- Utility.update_nodes(
109
+ acc_tag = XmlHelper.ox_element("acc", namespace: "m")
110
+ acc_pr_tag = XmlHelper.ox_element("accPr", namespace: "m")
111
+ acc_pr_tag << XmlHelper.ox_element("chr", namespace: "m",
112
+ attributes: { "m:val": "→" })
113
+ XmlHelper.update_nodes(
114
114
  acc_tag,
115
115
  [
116
116
  acc_pr_tag,