plurimath 0.3.9 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/lib/plurimath/latex/constants.rb +1 -0
  3. data/lib/plurimath/latex/parse.rb +11 -3
  4. data/lib/plurimath/latex/transform.rb +93 -7
  5. data/lib/plurimath/math/core.rb +16 -4
  6. data/lib/plurimath/math/formula.rb +24 -20
  7. data/lib/plurimath/math/function/abs.rb +2 -2
  8. data/lib/plurimath/math/function/bar.rb +48 -10
  9. data/lib/plurimath/math/function/base.rb +3 -3
  10. data/lib/plurimath/math/function/binary_function.rb +20 -10
  11. data/lib/plurimath/math/function/cancel.rb +2 -2
  12. data/lib/plurimath/math/function/ceil.rb +7 -2
  13. data/lib/plurimath/math/function/color.rb +2 -2
  14. data/lib/plurimath/math/function/ddot.rb +17 -12
  15. data/lib/plurimath/math/function/deg.rb +2 -2
  16. data/lib/plurimath/math/function/det.rb +2 -2
  17. data/lib/plurimath/math/function/dim.rb +2 -2
  18. data/lib/plurimath/math/function/dot.rb +26 -2
  19. data/lib/plurimath/math/function/exp.rb +2 -2
  20. data/lib/plurimath/math/function/fenced.rb +6 -7
  21. data/lib/plurimath/math/function/floor.rb +2 -2
  22. data/lib/plurimath/math/function/font_style/bold-fraktur.rb +17 -0
  23. data/lib/plurimath/math/function/font_style/bold-italic.rb +17 -0
  24. data/lib/plurimath/math/function/font_style/bold-sans-serif.rb +17 -0
  25. data/lib/plurimath/math/function/font_style/bold-script.rb +17 -0
  26. data/lib/plurimath/math/function/font_style/bold.rb +4 -0
  27. data/lib/plurimath/math/function/font_style/double_struck.rb +4 -0
  28. data/lib/plurimath/math/function/font_style/fraktur.rb +4 -0
  29. data/lib/plurimath/math/function/font_style/italic.rb +4 -0
  30. data/lib/plurimath/math/function/font_style/monospace.rb +4 -0
  31. data/lib/plurimath/math/function/font_style/normal.rb +4 -0
  32. data/lib/plurimath/math/function/font_style/sans-serif-bold-italic.rb +17 -0
  33. data/lib/plurimath/math/function/font_style/sans-serif-italic.rb +17 -0
  34. data/lib/plurimath/math/function/font_style/sans-serif.rb +4 -0
  35. data/lib/plurimath/math/function/font_style/script.rb +4 -0
  36. data/lib/plurimath/math/function/font_style.rb +24 -2
  37. data/lib/plurimath/math/function/frac.rb +3 -3
  38. data/lib/plurimath/math/function/gcd.rb +2 -2
  39. data/lib/plurimath/math/function/glb.rb +2 -2
  40. data/lib/plurimath/math/function/hat.rb +42 -9
  41. data/lib/plurimath/math/function/hom.rb +2 -2
  42. data/lib/plurimath/math/function/inf.rb +2 -2
  43. data/lib/plurimath/math/function/int.rb +4 -4
  44. data/lib/plurimath/math/function/ker.rb +2 -2
  45. data/lib/plurimath/math/function/lcm.rb +2 -2
  46. data/lib/plurimath/math/function/left.rb +1 -1
  47. data/lib/plurimath/math/function/lg.rb +2 -2
  48. data/lib/plurimath/math/function/lim.rb +2 -2
  49. data/lib/plurimath/math/function/liminf.rb +2 -2
  50. data/lib/plurimath/math/function/limits.rb +4 -4
  51. data/lib/plurimath/math/function/limsup.rb +2 -2
  52. data/lib/plurimath/math/function/ln.rb +2 -2
  53. data/lib/plurimath/math/function/log.rb +5 -3
  54. data/lib/plurimath/math/function/longdiv.rb +2 -2
  55. data/lib/plurimath/math/function/lub.rb +2 -2
  56. data/lib/plurimath/math/function/max.rb +2 -2
  57. data/lib/plurimath/math/function/mbox.rb +2 -2
  58. data/lib/plurimath/math/function/menclose.rb +2 -2
  59. data/lib/plurimath/math/function/merror.rb +1 -1
  60. data/lib/plurimath/math/function/min.rb +2 -2
  61. data/lib/plurimath/math/function/mod.rb +3 -3
  62. data/lib/plurimath/math/function/msgroup.rb +2 -2
  63. data/lib/plurimath/math/function/msline.rb +2 -2
  64. data/lib/plurimath/math/function/multiscript.rb +4 -4
  65. data/lib/plurimath/math/function/norm.rb +2 -2
  66. data/lib/plurimath/math/function/obrace.rb +40 -26
  67. data/lib/plurimath/math/function/oint.rb +4 -4
  68. data/lib/plurimath/math/function/over.rb +3 -3
  69. data/lib/plurimath/math/function/overset.rb +8 -3
  70. data/lib/plurimath/math/function/power.rb +3 -3
  71. data/lib/plurimath/math/function/power_base.rb +8 -8
  72. data/lib/plurimath/math/function/prod.rb +4 -4
  73. data/lib/plurimath/math/function/right.rb +1 -1
  74. data/lib/plurimath/math/function/root.rb +3 -3
  75. data/lib/plurimath/math/function/rule.rb +1 -1
  76. data/lib/plurimath/math/function/scarries.rb +2 -2
  77. data/lib/plurimath/math/function/semantics.rb +2 -2
  78. data/lib/plurimath/math/function/sqrt.rb +2 -2
  79. data/lib/plurimath/math/function/stackrel.rb +3 -3
  80. data/lib/plurimath/math/function/substack.rb +3 -3
  81. data/lib/plurimath/math/function/sum.rb +14 -19
  82. data/lib/plurimath/math/function/sup.rb +2 -2
  83. data/lib/plurimath/math/function/table.rb +7 -7
  84. data/lib/plurimath/math/function/td.rb +2 -2
  85. data/lib/plurimath/math/function/ternary_function.rb +13 -9
  86. data/lib/plurimath/math/function/text.rb +6 -5
  87. data/lib/plurimath/math/function/tilde.rb +27 -2
  88. data/lib/plurimath/math/function/tr.rb +2 -2
  89. data/lib/plurimath/math/function/ubrace.rb +28 -21
  90. data/lib/plurimath/math/function/ul.rb +55 -18
  91. data/lib/plurimath/math/function/unary_function.rb +13 -8
  92. data/lib/plurimath/math/function/underover.rb +10 -5
  93. data/lib/plurimath/math/function/underset.rb +8 -3
  94. data/lib/plurimath/math/function/vec.rb +25 -3
  95. data/lib/plurimath/math/number.rb +6 -2
  96. data/lib/plurimath/math/symbol.rb +6 -2
  97. data/lib/plurimath/math.rb +1 -0
  98. data/lib/plurimath/mathml/constants.rb +9 -1
  99. data/lib/plurimath/mathml/parser.rb +16 -10
  100. data/lib/plurimath/mathml/transform.rb +59 -31
  101. data/lib/plurimath/omml/parser.rb +24 -1
  102. data/lib/plurimath/omml/transform.rb +56 -41
  103. data/lib/plurimath/utility.rb +154 -9
  104. data/lib/plurimath/version.rb +1 -1
  105. metadata +8 -2
@@ -6,8 +6,8 @@ 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
9
+ def to_omml_without_math_tag(display_style)
10
+ omml_value(display_style)
11
11
  end
12
12
  end
13
13
  end
@@ -10,8 +10,8 @@ module Plurimath
10
10
  false
11
11
  end
12
12
 
13
- def to_omml_without_math_tag
14
- [r_element("lub"), omml_value]
13
+ def to_omml_without_math_tag(display_style)
14
+ [r_element("lub", rpr_tag: false), omml_value(display_style)]
15
15
  end
16
16
  end
17
17
  end
@@ -10,8 +10,8 @@ module Plurimath
10
10
  false
11
11
  end
12
12
 
13
- def to_omml_without_math_tag
14
- [r_element("max"), omml_value]
13
+ def to_omml_without_math_tag(display_style)
14
+ [r_element("max", rpr_tag: false), omml_value(display_style)]
15
15
  end
16
16
  end
17
17
  end
@@ -20,8 +20,8 @@ module Plurimath
20
20
  parameter_one&.to_html
21
21
  end
22
22
 
23
- def to_omml_without_math_tag
24
- omml_value
23
+ def to_omml_without_math_tag(display_style)
24
+ omml_value(display_style)
25
25
  end
26
26
  end
27
27
  end
@@ -26,7 +26,7 @@ module Plurimath
26
26
  "<menclose notation=\"#{parameter_one}\">#{second_value}</menclose>"
27
27
  end
28
28
 
29
- def to_omml_without_math_tag
29
+ def to_omml_without_math_tag(display_style)
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")
@@ -34,7 +34,7 @@ module Plurimath
34
34
  borderbox,
35
35
  [
36
36
  borderpr,
37
- omml_parameter(parameter_two, tag_name: "e"),
37
+ omml_parameter(parameter_two, display_style, tag_name: "e"),
38
38
  ],
39
39
  )
40
40
  [borderbox]
@@ -6,7 +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
+ def to_omml_without_math_tag(display_style); end
10
10
  end
11
11
  end
12
12
  end
@@ -10,8 +10,8 @@ module Plurimath
10
10
  false
11
11
  end
12
12
 
13
- def to_omml_without_math_tag
14
- [r_element("min"), omml_value]
13
+ def to_omml_without_math_tag(display_style)
14
+ [r_element("min", rpr_tag: false), omml_value(display_style)]
15
15
  end
16
16
  end
17
17
  end
@@ -39,11 +39,11 @@ module Plurimath
39
39
  "#{first_value}<i>mod</i>#{second_value}"
40
40
  end
41
41
 
42
- def to_omml_without_math_tag
42
+ def to_omml_without_math_tag(display_style)
43
43
  values = []
44
- values << parameter_one.insert_t_tag if parameter_one
44
+ values << parameter_one.insert_t_tag(display_style) if parameter_one
45
45
  values << r_element("mod")
46
- values << parameter_two.insert_t_tag if parameter_two
46
+ values << parameter_two.insert_t_tag(display_style) if parameter_two
47
47
  values
48
48
  end
49
49
  end
@@ -21,8 +21,8 @@ module Plurimath
21
21
  )
22
22
  end
23
23
 
24
- def to_omml_without_math_tag
25
- omml_value
24
+ def to_omml_without_math_tag(display_style)
25
+ omml_value(display_style)
26
26
  end
27
27
 
28
28
  def to_html
@@ -6,8 +6,8 @@ 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
9
+ def to_omml_without_math_tag(display_style)
10
+ omml_value(display_style)
11
11
  end
12
12
  end
13
13
  end
@@ -5,16 +5,16 @@ module Plurimath
5
5
  module Math
6
6
  module Function
7
7
  class Multiscript < TernaryFunction
8
- def to_omml_without_math_tag
8
+ def to_omml_without_math_tag(display_style)
9
9
  pre_element = Utility.ox_element("sPre", namespace: "m")
10
10
  pr_element = Utility.ox_element("sPrePr", namespace: "m")
11
11
  Utility.update_nodes(
12
12
  pre_element,
13
13
  [
14
14
  pr_element << Utility.pr_element("ctrl", true, namespace: "m"),
15
- omml_parameter(parameter_two, tag_name: "sub"),
16
- omml_parameter(parameter_three, tag_name: "sup"),
17
- omml_parameter(parameter_one, tag_name: "e"),
15
+ omml_parameter(parameter_two, display_style, tag_name: "sub"),
16
+ omml_parameter(parameter_three, display_style, tag_name: "sup"),
17
+ omml_parameter(parameter_one, display_style, tag_name: "e"),
18
18
  ],
19
19
  )
20
20
  [pre_element]
@@ -27,10 +27,10 @@ module Plurimath
27
27
  )
28
28
  end
29
29
 
30
- def to_omml_without_math_tag
30
+ def to_omml_without_math_tag(display_style)
31
31
  [
32
32
  r_element("∥"),
33
- omml_value,
33
+ omml_value(display_style),
34
34
  r_element("∥"),
35
35
  ]
36
36
  end
@@ -6,6 +6,18 @@ module Plurimath
6
6
  module Math
7
7
  module Function
8
8
  class Obrace < UnaryFunction
9
+ attr_accessor :attributes
10
+
11
+ def initialize(parameter_one = nil, attributes = {})
12
+ super(parameter_one)
13
+ @attributes = attributes
14
+ end
15
+
16
+ def to_asciimath
17
+ first_value = "(#{parameter_one.to_asciimath})" if parameter_one
18
+ "obrace#{first_value}"
19
+ end
20
+
9
21
  def to_latex
10
22
  first_value = "{#{parameter_one.to_latex}}" if parameter_one
11
23
  "\\overbrace#{first_value}"
@@ -13,46 +25,48 @@ module Plurimath
13
25
 
14
26
  def to_mathml_without_math_tag
15
27
  mo_tag = (Utility.ox_element("mo") << "&#x23de;")
16
- if parameter_one
17
- over_tag = Utility.ox_element("mover")
18
- arr_value = mathml_value
19
- Utility.update_nodes(over_tag, (arr_value << mo_tag))
20
- else
21
- mo_tag
22
- end
28
+ return mo_tag unless parameter_one
29
+
30
+ over_tag = Utility.ox_element("mover")
31
+ over_tag.attributes.merge!(attributes) if attributes && !attributes.empty?
32
+ Utility.update_nodes(
33
+ over_tag,
34
+ [
35
+ parameter_one.to_mathml_without_math_tag,
36
+ mo_tag,
37
+ ],
38
+ )
23
39
  end
24
40
 
25
41
  def validate_function_formula
26
42
  false
27
43
  end
28
44
 
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]
45
+ def to_omml_without_math_tag(display_style)
46
+ return r_element("", rpr_tag: false) unless parameter_one
47
+
48
+ if attributes && attributes[:accent]
49
+ acc_tag(display_style)
50
+ else
51
+ symbol = Symbol.new("")
52
+ Overset.new(parameter_one, symbol).to_omml_without_math_tag(true)
53
+ end
39
54
  end
40
55
 
41
56
  protected
42
57
 
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" })
58
+ def acc_tag(display_style)
59
+ acc_tag = Utility.ox_element("acc", namespace: "m")
60
+ acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
61
+ acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "⏞" }))
48
62
  Utility.update_nodes(
49
- groupchrpr,
63
+ acc_tag,
50
64
  [
51
- chr,
52
- pos,
53
- vert_jc,
65
+ acc_pr_tag,
66
+ omml_parameter(parameter_one, display_style, tag_name: "e", namespace: "m"),
54
67
  ],
55
68
  )
69
+ [acc_tag]
56
70
  end
57
71
  end
58
72
 
@@ -43,16 +43,16 @@ module Plurimath
43
43
  )
44
44
  end
45
45
 
46
- def to_omml_without_math_tag
46
+ def to_omml_without_math_tag(display_style)
47
47
  if all_values_exist?
48
48
  nary = Utility.ox_element("nary", namespace: "m")
49
49
  Utility.update_nodes(
50
50
  nary,
51
51
  [
52
52
  narypr("∮", function_type: "subSup"),
53
- omml_parameter(parameter_one, tag_name: "sub"),
54
- omml_parameter(parameter_two, tag_name: "sup"),
55
- omml_parameter(parameter_three, tag_name: "e"),
53
+ omml_parameter(parameter_one, display_style, tag_name: "sub"),
54
+ omml_parameter(parameter_two, display_style, tag_name: "sup"),
55
+ omml_parameter(parameter_three, display_style, tag_name: "e"),
56
56
  ],
57
57
  )
58
58
  [nary]
@@ -31,15 +31,15 @@ module Plurimath
31
31
  "{#{first_value} \\over #{two_value}}"
32
32
  end
33
33
 
34
- def to_omml_without_math_tag
34
+ def to_omml_without_math_tag(display_style)
35
35
  f_element = Utility.ox_element("f", namespace: "m")
36
36
  fpr_element = Utility.ox_element("fPr", namespace: "m")
37
37
  Utility.update_nodes(
38
38
  f_element,
39
39
  [
40
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"),
41
+ omml_parameter(parameter_one, display_style, tag_name: "num"),
42
+ omml_parameter(parameter_two, display_style, tag_name: "den"),
43
43
  ],
44
44
  )
45
45
  [f_element]
@@ -19,7 +19,12 @@ module Plurimath
19
19
  )
20
20
  end
21
21
 
22
- def to_omml_without_math_tag
22
+ def to_omml_without_math_tag(display_style)
23
+ if !display_style
24
+ power = Power.new(parameter_one, parameter_two)
25
+ return power.to_omml_without_math_tag(display_style)
26
+ end
27
+
23
28
  limupp = Utility.ox_element("limUpp", namespace: "m")
24
29
  limupppr = Utility.ox_element("limUppPr", namespace: "m")
25
30
  limupppr << Utility.pr_element("ctrl", true, namespace: "m")
@@ -27,8 +32,8 @@ module Plurimath
27
32
  limupp,
28
33
  [
29
34
  limupppr,
30
- omml_parameter(parameter_one, tag_name: "e"),
31
- omml_parameter(parameter_two, tag_name: "lim"),
35
+ omml_parameter(parameter_one, display_style, tag_name: "e"),
36
+ omml_parameter(parameter_two, display_style, tag_name: "lim"),
32
37
  ],
33
38
  )
34
39
  [limupp]
@@ -31,7 +31,7 @@ module Plurimath
31
31
  "#{first_value}#{second_value}"
32
32
  end
33
33
 
34
- def to_omml_without_math_tag
34
+ def to_omml_without_math_tag(display_style)
35
35
  ssup_element = Utility.ox_element("sSup", namespace: "m")
36
36
  suppr_element = Utility.ox_element("sSupPr", namespace: "m")
37
37
  suppr_element << Utility.pr_element("ctrl", true, namespace: "m")
@@ -39,8 +39,8 @@ module Plurimath
39
39
  ssup_element,
40
40
  [
41
41
  suppr_element,
42
- omml_parameter(parameter_one, tag_name: "e"),
43
- omml_parameter(parameter_two, tag_name: "sup"),
42
+ omml_parameter(parameter_one, display_style, tag_name: "e"),
43
+ omml_parameter(parameter_two, display_style, tag_name: "sup"),
44
44
  ],
45
45
  )
46
46
  [ssup_element]
@@ -29,7 +29,7 @@ module Plurimath
29
29
  "#{first_value}#{second_value}#{third_value}"
30
30
  end
31
31
 
32
- def omml_nary_tag
32
+ def omml_nary_tag(display_style)
33
33
  narypr = Utility.ox_element("naryPr", namespace: "m")
34
34
  chr_value(narypr)
35
35
  narypr << Utility.ox_element(
@@ -41,13 +41,13 @@ module Plurimath
41
41
  narypr << Utility.pr_element("ctrl", true, namespace: "m")
42
42
  [
43
43
  narypr,
44
- omml_parameter(parameter_two, tag_name: "sub"),
45
- omml_parameter(parameter_three, tag_name: "sup"),
44
+ omml_parameter(parameter_two, display_style, tag_name: "sub"),
45
+ omml_parameter(parameter_three, display_style, tag_name: "sup"),
46
46
  ]
47
47
  end
48
48
 
49
- def to_omml_without_math_tag
50
- return underover if parameter_one.omml_tag_name == "undOvr"
49
+ def to_omml_without_math_tag(display_style)
50
+ return underover(display_style) if parameter_one.omml_tag_name == "undOvr"
51
51
 
52
52
  ssubsup = Utility.ox_element("sSubSup", namespace: "m")
53
53
  ssubsuppr = Utility.ox_element("sSubSupPr", namespace: "m")
@@ -58,9 +58,9 @@ module Plurimath
58
58
  ssubsup,
59
59
  [
60
60
  ssubsuppr,
61
- omml_parameter(parameter_one, tag_name: "e"),
62
- omml_parameter(parameter_two, tag_name: "sub"),
63
- omml_parameter(parameter_three, tag_name: "sup"),
61
+ omml_parameter(parameter_one, display_style, tag_name: "e"),
62
+ omml_parameter(parameter_two, display_style, tag_name: "sub"),
63
+ omml_parameter(parameter_three, display_style, tag_name: "sup"),
64
64
  ],
65
65
  )
66
66
  [ssubsup]
@@ -54,16 +54,16 @@ module Plurimath
54
54
  "<i>&prod;</i>#{first_value}#{second_value}"
55
55
  end
56
56
 
57
- def to_omml_without_math_tag
57
+ def to_omml_without_math_tag(display_style)
58
58
  if all_values_exist?
59
59
  nary = Utility.ox_element("nary", namespace: "m")
60
60
  Utility.update_nodes(
61
61
  nary,
62
62
  [
63
63
  narypr("∏"),
64
- omml_parameter(parameter_one, tag_name: "sub"),
65
- omml_parameter(parameter_two, tag_name: "sup"),
66
- omml_parameter(parameter_three, tag_name: "e"),
64
+ omml_parameter(parameter_one, display_style, tag_name: "sub"),
65
+ omml_parameter(parameter_two, display_style, tag_name: "sup"),
66
+ omml_parameter(parameter_three, display_style, tag_name: "e"),
67
67
  ],
68
68
  )
69
69
  [nary]
@@ -16,7 +16,7 @@ module Plurimath
16
16
  mo
17
17
  end
18
18
 
19
- def to_omml_without_math_tag
19
+ def to_omml_without_math_tag(display_style)
20
20
  mr = Utility.ox_element("m:r")
21
21
  if parameter_one
22
22
  mt = Utility.ox_element("m:t")
@@ -24,15 +24,15 @@ module Plurimath
24
24
  "\\sqrt[#{first_value}]{#{second_value}}"
25
25
  end
26
26
 
27
- def to_omml_without_math_tag
27
+ def to_omml_without_math_tag(display_style)
28
28
  rad_element = Utility.ox_element("rad", namespace: "m")
29
29
  pr_element = Utility.ox_element("radPr", namespace: "m")
30
30
  Utility.update_nodes(
31
31
  rad_element,
32
32
  [
33
33
  (pr_element << Utility.pr_element("ctrl", true, namespace: "m")),
34
- omml_parameter(parameter_two, tag_name: "deg"),
35
- omml_parameter(parameter_one, tag_name: "e"),
34
+ omml_parameter(parameter_two, display_style, tag_name: "deg"),
35
+ omml_parameter(parameter_one, display_style, tag_name: "e"),
36
36
  ],
37
37
  )
38
38
  [rad_element]
@@ -20,7 +20,7 @@ module Plurimath
20
20
  Utility.ox_element("mi")
21
21
  end
22
22
 
23
- def to_omml_without_math_tag
23
+ def to_omml_without_math_tag(display_style)
24
24
  [Utility.ox_element("m:r") << Utility.ox_element("m:t")]
25
25
  end
26
26
 
@@ -6,8 +6,8 @@ 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
9
+ def to_omml_without_math_tag(display_style)
10
+ omml_value(display_style)
11
11
  end
12
12
  end
13
13
  end
@@ -23,8 +23,8 @@ 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)
26
+ def to_omml_without_math_tag(display_style)
27
+ Array(parameter_one.insert_t_tag(display_style))
28
28
  end
29
29
 
30
30
  protected
@@ -13,7 +13,7 @@ module Plurimath
13
13
  sqrt_tag
14
14
  end
15
15
 
16
- def to_omml_without_math_tag
16
+ def to_omml_without_math_tag(display_style)
17
17
  rad_element = Utility.ox_element("rad", namespace: "m")
18
18
  pr_element = Utility.ox_element("radPr", namespace: "m")
19
19
  pr_element << Utility.ox_element(
@@ -26,7 +26,7 @@ module Plurimath
26
26
  [
27
27
  (pr_element << Utility.pr_element("ctrl", true, namespace: "m")),
28
28
  Utility.ox_element("deg", namespace: "m"),
29
- omml_parameter(parameter_one, tag_name: "e"),
29
+ omml_parameter(parameter_one, display_style, tag_name: "e"),
30
30
  ],
31
31
  )
32
32
  [rad_element]
@@ -27,7 +27,7 @@ module Plurimath
27
27
  "#{first_value}#{second_value}"
28
28
  end
29
29
 
30
- def to_omml_without_math_tag
30
+ def to_omml_without_math_tag(display_style)
31
31
  limupp = Utility.ox_element("limUpp", namespace: "m")
32
32
  limupppr = Utility.ox_element("limUppPr", namespace: "m")
33
33
  limupppr << Utility.pr_element("ctrl", true, namespace: "m")
@@ -35,8 +35,8 @@ module Plurimath
35
35
  limupp,
36
36
  [
37
37
  limupppr,
38
- omml_parameter(parameter_two, tag_name: "e"),
39
- omml_parameter(parameter_one, tag_name: "lim"),
38
+ omml_parameter(parameter_two, display_style, tag_name: "e"),
39
+ omml_parameter(parameter_one, display_style, tag_name: "lim"),
40
40
  ],
41
41
  )
42
42
  [limupp]
@@ -19,13 +19,13 @@ module Plurimath
19
19
  Utility.update_nodes(Utility.ox_element("mtable"), value_array)
20
20
  end
21
21
 
22
- def to_omml_without_math_tag
22
+ def to_omml_without_math_tag(display_style)
23
23
  Array(
24
24
  Utility.update_nodes(
25
25
  mm_element,
26
26
  [
27
- omml_parameter(parameter_one, tag_name: "mr"),
28
- omml_parameter(parameter_two, tag_name: "mr"),
27
+ omml_parameter(parameter_one, display_style, tag_name: "mr"),
28
+ omml_parameter(parameter_two, display_style, tag_name: "mr"),
29
29
  ],
30
30
  ),
31
31
  )
@@ -54,25 +54,20 @@ module Plurimath
54
54
  "<i>&sum;</i>#{first_value}#{second_value}"
55
55
  end
56
56
 
57
- def to_omml_without_math_tag
58
- if all_values_exist?
59
- nary = Utility.ox_element("nary", namespace: "m")
60
- Utility.update_nodes(
61
- nary,
62
- [
63
- narypr("∑"),
64
- omml_parameter(parameter_one, tag_name: "sub"),
65
- omml_parameter(parameter_two, tag_name: "sup"),
66
- omml_parameter(parameter_three, tag_name: "e"),
67
- ],
68
- )
69
- [nary]
70
- else
71
- r_tag = Utility.ox_element("r", namespace: "m")
72
- t_tag = Utility.ox_element("t", namespace: "m")
73
- r_tag << (t_tag << "&#x2211;")
74
- [r_tag]
75
- end
57
+ def to_omml_without_math_tag(display_style)
58
+ return r_element("&#x2211;", rpr_tag: false) unless all_values_exist?
59
+
60
+ nary = Utility.ox_element("nary", namespace: "m")
61
+ Utility.update_nodes(
62
+ nary,
63
+ [
64
+ narypr(""),
65
+ omml_parameter(parameter_one, display_style, tag_name: "sub"),
66
+ omml_parameter(parameter_two, display_style, tag_name: "sup"),
67
+ omml_parameter(parameter_three, display_style, tag_name: "e"),
68
+ ],
69
+ )
70
+ [nary]
76
71
  end
77
72
 
78
73
  def omml_tag_name
@@ -10,8 +10,8 @@ module Plurimath
10
10
  Utility.ox_element("mo") << "sup"
11
11
  end
12
12
 
13
- def to_omml_without_math_tag
14
- [r_element("sup"), omml_value]
13
+ def to_omml_without_math_tag(display_style)
14
+ [r_element("sup", rpr_tag: false), omml_value(display_style)]
15
15
  end
16
16
  end
17
17
  end
@@ -69,11 +69,11 @@ module Plurimath
69
69
  "<table>#{first_value}</table>"
70
70
  end
71
71
 
72
- def to_omml_without_math_tag
72
+ def to_omml_without_math_tag(display_style)
73
73
  if value.map { |d| d.parameter_one.length == 1 }.all?
74
- single_td_table
74
+ single_td_table(display_style)
75
75
  else
76
- fenced_table(multiple_td_table)
76
+ fenced_table(multiple_td_table(display_style))
77
77
  end
78
78
  end
79
79
 
@@ -160,17 +160,17 @@ module Plurimath
160
160
  matrices_hash.invert[open_paren].to_s if matric_value
161
161
  end
162
162
 
163
- def single_td_table
163
+ def single_td_table(display_style)
164
164
  eqarr = Utility.ox_element("eqArr", namespace: "m")
165
165
  eqarrpr = Utility.ox_element("eqArrPr", namespace: "m")
166
166
  eqarrpr << Utility.pr_element("ctrl", true, namespace: "m")
167
167
  eqarr << eqarrpr
168
- tr_value = value.map(&:to_omml_without_math_tag).flatten
168
+ tr_value = value.map { |obj| obj.to_omml_without_math_tag(display_style) }.flatten
169
169
  Utility.update_nodes(eqarr, tr_value.compact)
170
170
  [eqarr]
171
171
  end
172
172
 
173
- def multiple_td_table
173
+ def multiple_td_table(display_style)
174
174
  count = { "m:val": value&.first&.parameter_one&.count }
175
175
  mcjc = { "m:val": "center" }
176
176
  mm = Utility.ox_element("m", namespace: "m")
@@ -194,7 +194,7 @@ module Plurimath
194
194
  mcs << mc
195
195
  mpr << mcs
196
196
  mpr << ctrlpr
197
- mm_value = value&.map(&:to_omml_without_math_tag)
197
+ mm_value = value&.map { |obj| obj.to_omml_without_math_tag(display_style) }
198
198
  Utility.update_nodes(
199
199
  mm,
200
200
  mm_value.insert(0, mpr).flatten,
@@ -32,13 +32,13 @@ module Plurimath
32
32
  "<td>#{first_value}</td>"
33
33
  end
34
34
 
35
- def to_omml_without_math_tag
35
+ def to_omml_without_math_tag(display_style)
36
36
  me = Utility.ox_element("e", namespace: "m")
37
37
  return [me] if parameter_one&.empty?
38
38
 
39
39
  Utility.update_nodes(
40
40
  me,
41
- Formula.new(parameter_one).omml_content,
41
+ Formula.new(parameter_one).omml_content(display_style),
42
42
  )
43
43
  [me]
44
44
  end