plurimath 0.3.7 → 0.3.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/plurimath/asciimath/constants.rb +1 -1
  3. data/lib/plurimath/latex/constants.rb +3 -5
  4. data/lib/plurimath/math/core.rb +10 -0
  5. data/lib/plurimath/math/function/binary_function.rb +4 -4
  6. data/lib/plurimath/math/function/cancel.rb +4 -0
  7. data/lib/plurimath/math/function/ceil.rb +7 -0
  8. data/lib/plurimath/math/function/color.rb +4 -0
  9. data/lib/plurimath/math/function/ddot.rb +4 -3
  10. data/lib/plurimath/math/function/deg.rb +4 -0
  11. data/lib/plurimath/math/function/det.rb +4 -0
  12. data/lib/plurimath/math/function/dim.rb +4 -0
  13. data/lib/plurimath/math/function/dot.rb +18 -0
  14. data/lib/plurimath/math/function/exp.rb +4 -0
  15. data/lib/plurimath/math/function/floor.rb +8 -0
  16. data/lib/plurimath/math/function/font_style.rb +1 -3
  17. data/lib/plurimath/math/function/gcd.rb +4 -0
  18. data/lib/plurimath/math/function/glb.rb +4 -0
  19. data/lib/plurimath/math/function/hat.rb +13 -0
  20. data/lib/plurimath/math/function/hom.rb +3 -0
  21. data/lib/plurimath/math/function/inf.rb +24 -17
  22. data/lib/plurimath/math/function/int.rb +8 -8
  23. data/lib/plurimath/math/function/ker.rb +3 -0
  24. data/lib/plurimath/math/function/lcm.rb +3 -0
  25. data/lib/plurimath/math/function/lg.rb +4 -0
  26. data/lib/plurimath/math/function/lim.rb +3 -1
  27. data/lib/plurimath/math/function/liminf.rb +3 -0
  28. data/lib/plurimath/math/function/limsup.rb +3 -0
  29. data/lib/plurimath/math/function/ln.rb +4 -0
  30. data/lib/plurimath/math/function/longdiv.rb +3 -0
  31. data/lib/plurimath/math/function/lub.rb +4 -0
  32. data/lib/plurimath/math/function/max.rb +4 -0
  33. data/lib/plurimath/math/function/menclose.rb +1 -3
  34. data/lib/plurimath/math/function/merror.rb +1 -0
  35. data/lib/plurimath/math/function/min.rb +4 -0
  36. data/lib/plurimath/math/function/mod.rb +8 -0
  37. data/lib/plurimath/math/function/msline.rb +3 -0
  38. data/lib/plurimath/math/function/norm.rb +8 -0
  39. data/lib/plurimath/math/function/obrace.rb +29 -4
  40. data/lib/plurimath/math/function/oint.rb +56 -3
  41. data/lib/plurimath/math/function/over.rb +15 -1
  42. data/lib/plurimath/math/function/phantom.rb +7 -4
  43. data/lib/plurimath/math/function/root.rb +2 -6
  44. data/lib/plurimath/math/function/scarries.rb +3 -0
  45. data/lib/plurimath/math/function/semantics.rb +4 -0
  46. data/lib/plurimath/math/function/sqrt.rb +1 -3
  47. data/lib/plurimath/math/function/stackrel.rb +15 -0
  48. data/lib/plurimath/math/function/substack.rb +45 -0
  49. data/lib/plurimath/math/function/sup.rb +4 -0
  50. data/lib/plurimath/math/function/ternary_function.rb +6 -4
  51. data/lib/plurimath/math/function/tilde.rb +14 -0
  52. data/lib/plurimath/math/function/ubrace.rb +16 -0
  53. data/lib/plurimath/math/function/ul.rb +2 -0
  54. data/lib/plurimath/math/function/unary_function.rb +0 -4
  55. data/lib/plurimath/math/function/vec.rb +14 -0
  56. data/lib/plurimath/version.rb +1 -1
  57. metadata +2 -3
  58. data/lib/plurimath/math/function/underline.rb +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39522e32ac4e62af9eb862173a64e6e8650a9531bae27f321f25c6a1bc594e95
4
- data.tar.gz: df5419195046dcf270cd4561c8cf3f9657536217a370d7a9aef150d7ca6aec72
3
+ metadata.gz: 78fffd236ecb53260b07fa02ce5cc2254d3835a6491229a7acc50c2a2ed80dbb
4
+ data.tar.gz: e17acb1342c8b5a7f5de3b8496962a12264404f9dd8902a42c47069a6ad0a157
5
5
  SHA512:
6
- metadata.gz: 0a2c7880f03ba5d70c508b61f9c272be5a4780cbc5a30f56e142f7aa6798b5a8059051c6ecaf80ac9c209ab2cda977d55d7354f28e06e42c3dd439e3e96c0349
7
- data.tar.gz: f2c0962524dc14232b0a48a4cd92015551f39603087bc42b08e73d0a3e66952ae2ab260f13166d159de378bd1757c24b0039a58d5b0fd129fb7be431f523e6a1
6
+ metadata.gz: a66739db5ef92081d8c73af2bbebaf77aa03bab5f8befbd14a9a80bdb4eea4d8c03e996dbc0aedbb5cf16c0bd90189a32dde1d67925c646f02cec6423e532f3c
7
+ data.tar.gz: 81e43972fead184a05ebc04948bba6433fef1ce6824223bd59b8a89d08c2ac41f4adbcb41e00426dd2d9dad6d6ff04a0ec2fc34ba7f51a7457f258b5087e0e72
@@ -312,11 +312,11 @@ module Plurimath
312
312
  ].freeze
313
313
  TERNARY_CLASSES = %w[
314
314
  prod
315
+ oint
315
316
  sum
316
317
  int
317
318
  ].freeze
318
319
  SUB_SUP_CLASSES = %w[
319
- oint
320
320
  lim
321
321
  log
322
322
  ].freeze
@@ -1601,7 +1601,6 @@ module Plurimath
1601
1601
  nmid: "∤",
1602
1602
  land: "∧",
1603
1603
  iint: "∬",
1604
- oint: "∮",
1605
1604
  nsim: "≁",
1606
1605
  cong: "≅",
1607
1606
  sdef: "≙",
@@ -1720,7 +1719,6 @@ module Plurimath
1720
1719
  lor: "∨",
1721
1720
  cap: "∩",
1722
1721
  cup: "∪",
1723
- int: "∫",
1724
1722
  sim: "∼",
1725
1723
  neq: "≠",
1726
1724
  leq: "≤",
@@ -2524,7 +2522,7 @@ module Plurimath
2524
2522
  rmoustache: :symbols,
2525
2523
  sqrtbottom: :symbols,
2526
2524
  underparen: :symbols,
2527
- underbrace: :underover,
2525
+ underbrace: :unary,
2528
2526
  hrectangle: :symbols,
2529
2527
  vrectangle: :symbols,
2530
2528
  LEFTcircle: :symbols,
@@ -3455,7 +3453,7 @@ module Plurimath
3455
3453
  nmid: :symbols,
3456
3454
  land: :symbols,
3457
3455
  iint: :symbols,
3458
- oint: :symbols,
3456
+ oint: :ternary,
3459
3457
  nsim: :symbols,
3460
3458
  cong: :symbols,
3461
3459
  sdef: :symbols,
@@ -3586,7 +3584,7 @@ module Plurimath
3586
3584
  lor: :symbols,
3587
3585
  cap: :symbols,
3588
3586
  cup: :symbols,
3589
- int: :symbols,
3587
+ int: :ternary,
3590
3588
  sim: :symbols,
3591
3589
  neq: :symbols,
3592
3590
  leq: :symbols,
@@ -38,6 +38,16 @@ module Plurimath
38
38
  def validate_function_formula
39
39
  true
40
40
  end
41
+
42
+ def r_element(string, rpr_tag: true)
43
+ r_tag = Utility.ox_element("r", namespace: "m")
44
+ if rpr_tag
45
+ sty_tag = Utility.ox_element("sty", namespace: "m", attributes: { "m:val": "p" })
46
+ r_tag << (Utility.ox_element("rPr", namespace: "m") << sty_tag)
47
+ end
48
+ r_tag << (Utility.ox_element("t", namespace: "m") << string)
49
+ Array(r_tag)
50
+ end
41
51
  end
42
52
  end
43
53
  end
@@ -56,10 +56,6 @@ module Plurimath
56
56
  [r_tag]
57
57
  end
58
58
 
59
- def class_name
60
- self.class.name.split("::").last.downcase
61
- end
62
-
63
59
  protected
64
60
 
65
61
  def latex_wrapped(field)
@@ -85,6 +81,10 @@ module Plurimath
85
81
  r_tag << (Utility.ox_element("t", namespace: "m") << "&#8203;")
86
82
  wrapper_tag << r_tag
87
83
  end
84
+
85
+ def all_values_exist?
86
+ !parameter_one.nil? && !parameter_two.nil?
87
+ end
88
88
  end
89
89
  end
90
90
  end
@@ -14,6 +14,10 @@ module Plurimath
14
14
  first_value = parameter_one&.to_mathml_without_math_tag
15
15
  Utility.update_nodes(cancel_tag, [first_value])
16
16
  end
17
+
18
+ def to_omml_without_math_tag
19
+ omml_value
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -19,6 +19,13 @@ module Plurimath
19
19
  first_value << right_value,
20
20
  )
21
21
  end
22
+
23
+ def to_omml_without_math_tag
24
+ lceil = Symbol.new("⌈")
25
+ rceil = Symbol.new("⌉")
26
+ fenced = Fenced.new(lceil, Array(parameter_one), rceil)
27
+ Array(fenced.to_omml_without_math_tag)
28
+ end
22
29
  end
23
30
  end
24
31
  end
@@ -27,6 +27,10 @@ module Plurimath
27
27
  second_value = parameter_two&.to_latex
28
28
  "{\\#{class_name}{#{first_value}} #{second_value}}"
29
29
  end
30
+
31
+ def to_omml_without_math_tag
32
+ Array(parameter_two.insert_t_tag)
33
+ end
30
34
  end
31
35
  end
32
36
  end
@@ -18,11 +18,12 @@ module Plurimath
18
18
  acc_tag = Utility.ox_element("acc", namespace: "m")
19
19
  acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
20
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
21
  Utility.update_nodes(
24
22
  acc_tag,
25
- [acc_pr_tag, me],
23
+ [
24
+ acc_pr_tag,
25
+ omml_parameter(parameter_one, tag_name: "e"),
26
+ ],
26
27
  )
27
28
  [acc_tag]
28
29
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("deg"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("det"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("dim"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -18,6 +18,24 @@ module Plurimath
18
18
  ],
19
19
  )
20
20
  end
21
+
22
+ def to_omml_without_math_tag
23
+ acc_tag = Utility.ox_element("acc", namespace: "m")
24
+ acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
25
+ acc_pr_tag << Utility.ox_element(
26
+ "chr",
27
+ namespace: "m",
28
+ attributes: { "m:val": "." },
29
+ )
30
+ Utility.update_nodes(
31
+ acc_tag,
32
+ [
33
+ acc_pr_tag,
34
+ omml_parameter(parameter_one, tag_name: "e"),
35
+ ],
36
+ )
37
+ [acc_tag]
38
+ end
21
39
  end
22
40
  end
23
41
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("exp"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -21,6 +21,14 @@ module Plurimath
21
21
  ],
22
22
  )
23
23
  end
24
+
25
+ def to_omml_without_math_tag
26
+ [
27
+ r_element("⌊"),
28
+ omml_value,
29
+ r_element("⌋"),
30
+ ]
31
+ end
24
32
  end
25
33
  end
26
34
  end
@@ -22,9 +22,7 @@ module Plurimath
22
22
  end
23
23
 
24
24
  def 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]
25
+ Array(parameter_one&.insert_t_tag)
28
26
  end
29
27
 
30
28
  def to_html
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("gcd"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("glb"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -22,6 +22,19 @@ module Plurimath
22
22
  def validate_function_formula
23
23
  false
24
24
  end
25
+
26
+ def to_omml_without_math_tag
27
+ acc_tag = Utility.ox_element("acc", namespace: "m")
28
+ acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
29
+ acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "̂" }))
30
+ me = Utility.ox_element("e", namespace: "m")
31
+ Utility.update_nodes(me, omml_value)
32
+ Utility.update_nodes(
33
+ acc_tag,
34
+ [acc_pr_tag, me],
35
+ )
36
+ [acc_tag]
37
+ end
25
38
  end
26
39
  end
27
40
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Hom < UnaryFunction
9
+ def to_omml_without_math_tag
10
+ [r_element("hom"), omml_value]
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -14,23 +14,30 @@ module Plurimath
14
14
 
15
15
  def to_mathml_without_math_tag
16
16
  first_value = Utility.ox_element("mo") << class_name
17
- if parameter_one || parameter_two
18
- value_array = [first_value]
19
- value_array << parameter_one&.to_mathml_without_math_tag
20
- value_array << parameter_two&.to_mathml_without_math_tag
21
- tag_name = if parameter_two && parameter_one
22
- "underover"
23
- else
24
- parameter_one ? "under" : "over"
25
- end
26
- munderover_tag = Utility.ox_element("m#{tag_name}")
27
- Utility.update_nodes(
28
- munderover_tag,
29
- value_array,
30
- )
31
- else
32
- first_value
33
- end
17
+ return first_value if all_values_exist?
18
+
19
+ value_array = [first_value]
20
+ value_array << parameter_one&.to_mathml_without_math_tag
21
+ value_array << parameter_two&.to_mathml_without_math_tag
22
+ tag_name = if parameter_two && parameter_one
23
+ "underover"
24
+ else
25
+ parameter_one ? "under" : "over"
26
+ end
27
+ Utility.update_nodes(
28
+ Utility.ox_element("m#{tag_name}"),
29
+ value_array,
30
+ )
31
+ end
32
+
33
+ def to_omml_without_math_tag
34
+ return r_element("inf", rpr_tag: false) unless all_values_exist?
35
+
36
+ inf = Symbol.new("inf")
37
+ overset = Overset.new(inf, parameter_two)
38
+ return Array(overset.to_omml_without_math_tag) unless parameter_one
39
+
40
+ Array(Underset.new(overset, parameter_one)&.to_omml_without_math_tag)
34
41
  end
35
42
  end
36
43
  end
@@ -13,22 +13,22 @@ module Plurimath
13
13
  end
14
14
 
15
15
  def to_latex
16
- first_value = "_#{latex_wrapped(parameter_one)}" if parameter_one
17
- second_value = "^#{latex_wrapped(parameter_two)}" if parameter_two
16
+ first_value = "_{#{parameter_one.to_latex}}" if parameter_one
17
+ second_value = "^{#{parameter_two.to_latex}}" if parameter_two
18
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
+ base_element = (Utility.ox_element("mo") << invert_unicode_symbols.to_s)
23
+ return base_element unless all_values_exist?
24
+
22
25
  msubsup_tag = Utility.ox_element("msubsup")
23
- mo_tag = Utility.ox_element("mo") << invert_unicode_symbols.to_s
24
- first_value = parameter_one&.to_mathml_without_math_tag if parameter_one
25
- second_value = parameter_two&.to_mathml_without_math_tag if parameter_two
26
26
  Utility.update_nodes(
27
27
  msubsup_tag,
28
28
  [
29
- mo_tag,
30
- first_value,
31
- second_value,
29
+ base_element,
30
+ validate_mathml_tag(parameter_one),
31
+ validate_mathml_tag(parameter_two),
32
32
  ],
33
33
  )
34
34
  return msubsup_tag if parameter_three.nil?
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Ker < UnaryFunction
9
+ def to_omml_without_math_tag
10
+ [r_element("ker"), omml_value]
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 Lcm < UnaryFunction
9
+ def to_omml_without_math_tag
10
+ [r_element("lcm"), omml_value]
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("lg"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -40,9 +40,11 @@ module Plurimath
40
40
  end
41
41
 
42
42
  def to_omml_without_math_tag
43
+ return r_element("lim", rpr_tag: false) unless all_values_exist?
44
+
43
45
  lim = Symbol.new("lim")
44
46
  overset = Overset.new(lim, parameter_two)
45
- return overset unless parameter_one
47
+ return overset.to_omml_without_math_tag unless parameter_one
46
48
 
47
49
  Underset.new(overset, parameter_one)&.to_omml_without_math_tag
48
50
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Liminf < UnaryFunction
9
+ def to_omml_without_math_tag
10
+ [r_element("liminf"), omml_value]
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 Limsup < UnaryFunction
9
+ def to_omml_without_math_tag
10
+ [r_element("limsup"), omml_value]
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("ln"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Longdiv < UnaryFunction
9
+ def to_omml_without_math_tag
10
+ omml_value
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("lub"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("max"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -30,13 +30,11 @@ module Plurimath
30
30
  borderbox = Utility.ox_element("borderBox", namespace: "m")
31
31
  borderpr = Utility.ox_element("borderBoxPr", namespace: "m")
32
32
  borderpr << Utility.pr_element("ctrl", true, namespace: "m")
33
- me = Utility.ox_element("e", namespace: "m")
34
- Utility.update_nodes(me, Array(parameter_two.to_omml_without_math_tag)) if parameter_two
35
33
  Utility.update_nodes(
36
34
  borderbox,
37
35
  [
38
36
  borderpr,
39
- me,
37
+ omml_parameter(parameter_two, tag_name: "e"),
40
38
  ],
41
39
  )
42
40
  [borderbox]
@@ -6,6 +6,7 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Merror < BinaryFunction
9
+ def to_omml_without_math_tag; end
9
10
  end
10
11
  end
11
12
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def validate_function_formula
10
10
  false
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("min"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -38,6 +38,14 @@ module Plurimath
38
38
  second_value = "<i>#{parameter_two.to_html}</i>" if parameter_two
39
39
  "#{first_value}<i>mod</i>#{second_value}"
40
40
  end
41
+
42
+ def to_omml_without_math_tag
43
+ values = []
44
+ values << parameter_one.insert_t_tag if parameter_one
45
+ values << r_element("mod")
46
+ values << parameter_two.insert_t_tag if parameter_two
47
+ values
48
+ end
41
49
  end
42
50
  end
43
51
  end
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Msline < UnaryFunction
9
+ def to_omml_without_math_tag
10
+ omml_value
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -26,6 +26,14 @@ module Plurimath
26
26
  ],
27
27
  )
28
28
  end
29
+
30
+ def to_omml_without_math_tag
31
+ [
32
+ r_element("∥"),
33
+ omml_value,
34
+ r_element("∥"),
35
+ ]
36
+ end
29
37
  end
30
38
  end
31
39
  end
@@ -22,13 +22,38 @@ module Plurimath
22
22
  end
23
23
  end
24
24
 
25
- def tag_name
26
- "underover"
27
- end
28
-
29
25
  def validate_function_formula
30
26
  false
31
27
  end
28
+
29
+ def to_omml_without_math_tag
30
+ groupchr = Utility.ox_element("groupChr", namespace: "m")
31
+ Utility.update_nodes(
32
+ groupchr,
33
+ [
34
+ group_chr_pr,
35
+ omml_parameter(parameter_one, tag_name: "e"),
36
+ ],
37
+ )
38
+ [groupchr]
39
+ end
40
+
41
+ protected
42
+
43
+ def group_chr_pr
44
+ groupchrpr = Utility.ox_element("groupChrPr", namespace: "m")
45
+ vert_jc = Utility.ox_element("vertJc", namespace: "m", attributes: { "m:val": "bot" })
46
+ chr = Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "⏞" })
47
+ pos = Utility.ox_element("pos", namespace: "m", attributes: { "m:val": "top" })
48
+ Utility.update_nodes(
49
+ groupchrpr,
50
+ [
51
+ chr,
52
+ pos,
53
+ vert_jc,
54
+ ],
55
+ )
56
+ end
32
57
  end
33
58
 
34
59
  Overbrace = Obrace
@@ -1,15 +1,68 @@
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 Oint < BinaryFunction
8
+ class Oint < 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
- "oint#{first_value}#{second_value}"
12
+ "oint#{first_value}#{second_value} #{parameter_three&.to_asciimath}".strip
13
+ end
14
+
15
+ def to_latex
16
+ first_value = "_#{latex_wrapped(parameter_one)}" if parameter_one
17
+ second_value = "^#{latex_wrapped(parameter_two)}" if parameter_two
18
+ "\\#{class_name}#{first_value}#{second_value} #{parameter_three&.to_latex}".strip
19
+ end
20
+
21
+ def to_mathml_without_math_tag
22
+ mo_tag = Utility.ox_element("mo") << invert_unicode_symbols.to_s
23
+ return mo_tag unless all_values_exist?
24
+
25
+ msubsup_tag = Utility.ox_element("msubsup")
26
+ first_value = parameter_one&.to_mathml_without_math_tag if parameter_one
27
+ second_value = parameter_two&.to_mathml_without_math_tag if parameter_two
28
+ Utility.update_nodes(
29
+ msubsup_tag,
30
+ [
31
+ mo_tag,
32
+ first_value,
33
+ second_value,
34
+ ],
35
+ )
36
+ return msubsup_tag if parameter_three.nil?
37
+
38
+ Utility.update_nodes(
39
+ Utility.ox_element("mrow"),
40
+ [
41
+ msubsup_tag,
42
+ parameter_three&.to_mathml_without_math_tag,
43
+ ].flatten.compact,
44
+ )
45
+ end
46
+
47
+ def to_omml_without_math_tag
48
+ if all_values_exist?
49
+ nary = Utility.ox_element("nary", namespace: "m")
50
+ Utility.update_nodes(
51
+ nary,
52
+ [
53
+ narypr("∮", function_type: "subSup"),
54
+ omml_parameter(parameter_one, tag_name: "sub"),
55
+ omml_parameter(parameter_two, tag_name: "sup"),
56
+ omml_parameter(parameter_three, tag_name: "e"),
57
+ ],
58
+ )
59
+ [nary]
60
+ else
61
+ r_tag = Utility.ox_element("r", namespace: "m")
62
+ t_tag = Utility.ox_element("t", namespace: "m")
63
+ r_tag << (t_tag << "&#x222e;")
64
+ [r_tag]
65
+ end
13
66
  end
14
67
  end
15
68
  end
@@ -9,7 +9,7 @@ module Plurimath
9
9
  def to_asciimath
10
10
  first_value = wrapped(parameter_one)
11
11
  second_value = wrapped(parameter_two)
12
- "overset#{first_value}#{second_value}"
12
+ "frac#{first_value}#{second_value}"
13
13
  end
14
14
 
15
15
  def to_mathml_without_math_tag
@@ -30,6 +30,20 @@ module Plurimath
30
30
  two_value = parameter_two&.to_latex
31
31
  "{#{first_value} \\over #{two_value}}"
32
32
  end
33
+
34
+ def to_omml_without_math_tag
35
+ f_element = Utility.ox_element("f", namespace: "m")
36
+ fpr_element = Utility.ox_element("fPr", namespace: "m")
37
+ Utility.update_nodes(
38
+ f_element,
39
+ [
40
+ fpr_element << Utility.pr_element("ctrl", true, namespace: "m"),
41
+ omml_parameter(parameter_one, tag_name: "num"),
42
+ omml_parameter(parameter_two, tag_name: "den"),
43
+ ],
44
+ )
45
+ [f_element]
46
+ end
33
47
  end
34
48
  end
35
49
  end
@@ -7,7 +7,7 @@ module Plurimath
7
7
  module Function
8
8
  class Phantom < UnaryFunction
9
9
  def to_asciimath
10
- "\"#{Array.new(parameter_one&.length, ' ').join}\""
10
+ "#{Array.new(parameter_one&.length, '\ ').join}"
11
11
  end
12
12
 
13
13
  def to_html
@@ -15,12 +15,15 @@ module Plurimath
15
15
  end
16
16
 
17
17
  def to_latex
18
- "<i>#{Array.new(parameter_one&.length, '\\ ').join}</i>"
18
+ Array.new(parameter_one&.length, '\\ ').join
19
19
  end
20
20
 
21
21
  def to_mathml_without_math_tag
22
- mi_tag_value = Array.new(parameter_one&.length, "&nbsp;&nbsp;").join
23
- Utility.ox_element("mi") << mi_tag_value
22
+ phantom = Utility.ox_element("mphantom")
23
+ Utility.update_nodes(
24
+ phantom,
25
+ parameter_one&.map(&:to_mathml_without_math_tag),
26
+ )
24
27
  end
25
28
  end
26
29
  end
@@ -27,16 +27,12 @@ module Plurimath
27
27
  def to_omml_without_math_tag
28
28
  rad_element = Utility.ox_element("rad", namespace: "m")
29
29
  pr_element = Utility.ox_element("radPr", namespace: "m")
30
- deg_element = Utility.ox_element("deg", namespace: "m")
31
- e_element = Utility.ox_element("e", namespace: "m")
32
- Utility.update_nodes(e_element, parameter_one.to_omml_without_math_tag)
33
- Utility.update_nodes(deg_element, parameter_two.to_omml_without_math_tag)
34
30
  Utility.update_nodes(
35
31
  rad_element,
36
32
  [
37
33
  (pr_element << Utility.pr_element("ctrl", true, namespace: "m")),
38
- deg_element,
39
- e_element,
34
+ omml_parameter(parameter_two, tag_name: "deg"),
35
+ omml_parameter(parameter_one, tag_name: "e"),
40
36
  ],
41
37
  )
42
38
  [rad_element]
@@ -6,6 +6,9 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Scarries < UnaryFunction
9
+ def to_omml_without_math_tag
10
+ omml_value
11
+ end
9
12
  end
10
13
  end
11
14
  end
@@ -23,6 +23,10 @@ module Plurimath
23
23
  parameter_one&.to_asciimath
24
24
  end
25
25
 
26
+ def to_omml_without_math_tag
27
+ Array(parameter_one.insert_t_tag)
28
+ end
29
+
26
30
  protected
27
31
 
28
32
  def other_tags(array)
@@ -21,14 +21,12 @@ module Plurimath
21
21
  namespace: "m",
22
22
  attributes: { "m:val": "1" },
23
23
  )
24
- e_element = Utility.ox_element("e", namespace: "m")
25
- Utility.update_nodes(e_element, omml_value)
26
24
  Utility.update_nodes(
27
25
  rad_element,
28
26
  [
29
27
  (pr_element << Utility.pr_element("ctrl", true, namespace: "m")),
30
28
  Utility.ox_element("deg", namespace: "m"),
31
- e_element,
29
+ omml_parameter(parameter_one, tag_name: "e"),
32
30
  ],
33
31
  )
34
32
  [rad_element]
@@ -27,6 +27,21 @@ module Plurimath
27
27
  "#{first_value}#{second_value}"
28
28
  end
29
29
 
30
+ def to_omml_without_math_tag
31
+ limupp = Utility.ox_element("limUpp", namespace: "m")
32
+ limupppr = Utility.ox_element("limUppPr", namespace: "m")
33
+ limupppr << Utility.pr_element("ctrl", true, namespace: "m")
34
+ Utility.update_nodes(
35
+ limupp,
36
+ [
37
+ limupppr,
38
+ omml_parameter(parameter_two, tag_name: "e"),
39
+ omml_parameter(parameter_one, tag_name: "lim"),
40
+ ],
41
+ )
42
+ [limupp]
43
+ end
44
+
30
45
  protected
31
46
 
32
47
  def wrapped(field)
@@ -18,6 +18,51 @@ module Plurimath
18
18
  value_array << parameter_two.to_mathml_without_math_tag if parameter_two
19
19
  Utility.update_nodes(Utility.ox_element("mtable"), value_array)
20
20
  end
21
+
22
+ def to_omml_without_math_tag
23
+ Array(
24
+ Utility.update_nodes(
25
+ mm_element,
26
+ [
27
+ omml_parameter(parameter_one, tag_name: "mr"),
28
+ omml_parameter(parameter_two, tag_name: "mr"),
29
+ ],
30
+ ),
31
+ )
32
+ end
33
+
34
+ protected
35
+
36
+ def mm_element
37
+ mcjc = Utility.ox_element(
38
+ "mcJc",
39
+ namespace: "m",
40
+ attributes: { "m:val": "center" },
41
+ )
42
+ mcount = Utility.ox_element(
43
+ "count",
44
+ namespace: "m",
45
+ attributes: { "m:val": "1" },
46
+ )
47
+ mbasejc = Utility.ox_element(
48
+ "baseJc",
49
+ namespace: "m",
50
+ attributes: { "m:val": "center", },
51
+ )
52
+ mplchide = Utility.ox_element(
53
+ "plcHide",
54
+ namespace: "m",
55
+ attributes: { "m:val": "1" },
56
+ )
57
+ mm = Utility.ox_element("m", namespace: "m")
58
+ mc = Utility.ox_element("mc", namespace: "m")
59
+ mpr = Utility.ox_element("mpr", namespace: "m")
60
+ mcs = Utility.ox_element("mcs", namespace: "m")
61
+ mcpr = Utility.ox_element("mcPr", namespace: "m")
62
+ mc << Utility.update_nodes(mcpr, [mcjc, mcount])
63
+ mcs << mc
64
+ Utility.update_nodes(mm, [mpr])
65
+ end
21
66
  end
22
67
  end
23
68
  end
@@ -9,6 +9,10 @@ module Plurimath
9
9
  def to_mathml_without_math_tag
10
10
  Utility.ox_element("mo") << "sup"
11
11
  end
12
+
13
+ def to_omml_without_math_tag
14
+ [r_element("sup"), omml_value]
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -51,10 +51,6 @@ module Plurimath
51
51
  "#{first_value}#{second_value}#{third_value}"
52
52
  end
53
53
 
54
- def class_name
55
- self.class.name.split("::").last.downcase
56
- end
57
-
58
54
  protected
59
55
 
60
56
  def latex_wrapped(field)
@@ -129,6 +125,12 @@ module Plurimath
129
125
  def all_values_exist?
130
126
  !(parameter_one.nil? && parameter_two.nil? && parameter_three.nil?)
131
127
  end
128
+
129
+ def validate_mathml_tag(parameter)
130
+ return Array(Utility.ox_element("mrow")) unless parameter
131
+
132
+ Array(parameter.to_mathml_without_math_tag)
133
+ end
132
134
  end
133
135
  end
134
136
  end
@@ -12,6 +12,20 @@ module Plurimath
12
12
  second_value = parameter_one.to_mathml_without_math_tag if parameter_one
13
13
  Utility.update_nodes(mover, [second_value, first_value])
14
14
  end
15
+
16
+ def to_omml_without_math_tag
17
+ acc_tag = Utility.ox_element("acc", namespace: "m")
18
+ acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
19
+ acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "˜" }))
20
+ Utility.update_nodes(
21
+ acc_tag,
22
+ [
23
+ acc_pr_tag,
24
+ omml_parameter(parameter_one, tag_name: "e"),
25
+ ],
26
+ )
27
+ [acc_tag]
28
+ end
15
29
  end
16
30
  end
17
31
  end
@@ -29,6 +29,22 @@ module Plurimath
29
29
  def validate_function_formula
30
30
  false
31
31
  end
32
+
33
+ def to_omml_without_math_tag
34
+ limlow = Utility.ox_element("limLow", namespace: "m")
35
+ limlowpr = Utility.ox_element("limLowPr", namespace: "m")
36
+ limlowpr << Utility.pr_element("ctrl", true, namespace: "m")
37
+ lim = Utility.ox_element("lim", namespace: "m")
38
+ Utility.update_nodes(
39
+ limlow,
40
+ [
41
+ limlowpr,
42
+ omml_parameter(parameter_one, tag_name: "e"),
43
+ Utility.update_nodes(lim, r_element("⏟")),
44
+ ],
45
+ )
46
+ [limlow]
47
+ end
32
48
  end
33
49
 
34
50
  Underbrace = Ubrace
@@ -37,6 +37,8 @@ module Plurimath
37
37
  "underline"
38
38
  end
39
39
  end
40
+
41
+ Underline = Ul
40
42
  end
41
43
  end
42
44
  end
@@ -74,10 +74,6 @@ module Plurimath
74
74
  [func]
75
75
  end
76
76
 
77
- def class_name
78
- self.class.name.split("::").last.downcase
79
- end
80
-
81
77
  protected
82
78
 
83
79
  def asciimath_value
@@ -16,6 +16,20 @@ module Plurimath
16
16
  ],
17
17
  )
18
18
  end
19
+
20
+ def to_omml_without_math_tag
21
+ acc_tag = Utility.ox_element("acc", namespace: "m")
22
+ acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
23
+ acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "→" }))
24
+ Utility.update_nodes(
25
+ acc_tag,
26
+ [
27
+ acc_pr_tag,
28
+ omml_parameter(parameter_one, tag_name: "e"),
29
+ ],
30
+ )
31
+ [acc_tag]
32
+ end
19
33
  end
20
34
  end
21
35
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plurimath
4
- VERSION = "0.3.7"
4
+ VERSION = "0.3.8"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plurimath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-02 00:00:00.000000000 Z
11
+ date: 2023-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -183,7 +183,6 @@ files:
183
183
  - lib/plurimath/math/function/ubrace.rb
184
184
  - lib/plurimath/math/function/ul.rb
185
185
  - lib/plurimath/math/function/unary_function.rb
186
- - lib/plurimath/math/function/underline.rb
187
186
  - lib/plurimath/math/function/underover.rb
188
187
  - lib/plurimath/math/function/underset.rb
189
188
  - lib/plurimath/math/function/vec.rb
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "unary_function"
4
-
5
- module Plurimath
6
- module Math
7
- module Function
8
- class Underline < UnaryFunction
9
- end
10
- end
11
- end
12
- end