plurimath 0.3.9 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/lib/plurimath/math/core.rb +16 -4
  3. data/lib/plurimath/math/formula.rb +24 -20
  4. data/lib/plurimath/math/function/abs.rb +2 -2
  5. data/lib/plurimath/math/function/bar.rb +43 -12
  6. data/lib/plurimath/math/function/base.rb +3 -3
  7. data/lib/plurimath/math/function/binary_function.rb +16 -10
  8. data/lib/plurimath/math/function/cancel.rb +2 -2
  9. data/lib/plurimath/math/function/ceil.rb +7 -2
  10. data/lib/plurimath/math/function/color.rb +2 -2
  11. data/lib/plurimath/math/function/ddot.rb +10 -12
  12. data/lib/plurimath/math/function/deg.rb +2 -2
  13. data/lib/plurimath/math/function/det.rb +2 -2
  14. data/lib/plurimath/math/function/dim.rb +2 -2
  15. data/lib/plurimath/math/function/dot.rb +21 -4
  16. data/lib/plurimath/math/function/exp.rb +2 -2
  17. data/lib/plurimath/math/function/fenced.rb +2 -1
  18. data/lib/plurimath/math/function/floor.rb +2 -2
  19. data/lib/plurimath/math/function/font_style/bold-fraktur.rb +17 -0
  20. data/lib/plurimath/math/function/font_style/bold-italic.rb +17 -0
  21. data/lib/plurimath/math/function/font_style/bold-sans-serif.rb +17 -0
  22. data/lib/plurimath/math/function/font_style/bold-script.rb +17 -0
  23. data/lib/plurimath/math/function/font_style/bold.rb +4 -0
  24. data/lib/plurimath/math/function/font_style/double_struck.rb +4 -0
  25. data/lib/plurimath/math/function/font_style/fraktur.rb +4 -0
  26. data/lib/plurimath/math/function/font_style/italic.rb +4 -0
  27. data/lib/plurimath/math/function/font_style/monospace.rb +4 -0
  28. data/lib/plurimath/math/function/font_style/normal.rb +4 -0
  29. data/lib/plurimath/math/function/font_style/sans-serif-bold-italic.rb +17 -0
  30. data/lib/plurimath/math/function/font_style/sans-serif-italic.rb +17 -0
  31. data/lib/plurimath/math/function/font_style/sans-serif.rb +4 -0
  32. data/lib/plurimath/math/function/font_style/script.rb +4 -0
  33. data/lib/plurimath/math/function/font_style.rb +22 -4
  34. data/lib/plurimath/math/function/frac.rb +3 -3
  35. data/lib/plurimath/math/function/gcd.rb +2 -2
  36. data/lib/plurimath/math/function/glb.rb +2 -2
  37. data/lib/plurimath/math/function/hat.rb +37 -11
  38. data/lib/plurimath/math/function/hom.rb +2 -2
  39. data/lib/plurimath/math/function/inf.rb +2 -2
  40. data/lib/plurimath/math/function/int.rb +4 -4
  41. data/lib/plurimath/math/function/ker.rb +2 -2
  42. data/lib/plurimath/math/function/lcm.rb +2 -2
  43. data/lib/plurimath/math/function/left.rb +1 -1
  44. data/lib/plurimath/math/function/lg.rb +2 -2
  45. data/lib/plurimath/math/function/lim.rb +2 -2
  46. data/lib/plurimath/math/function/liminf.rb +2 -2
  47. data/lib/plurimath/math/function/limits.rb +4 -4
  48. data/lib/plurimath/math/function/limsup.rb +2 -2
  49. data/lib/plurimath/math/function/ln.rb +2 -2
  50. data/lib/plurimath/math/function/log.rb +5 -3
  51. data/lib/plurimath/math/function/longdiv.rb +2 -2
  52. data/lib/plurimath/math/function/lub.rb +2 -2
  53. data/lib/plurimath/math/function/max.rb +2 -2
  54. data/lib/plurimath/math/function/mbox.rb +2 -2
  55. data/lib/plurimath/math/function/menclose.rb +2 -2
  56. data/lib/plurimath/math/function/merror.rb +1 -1
  57. data/lib/plurimath/math/function/min.rb +2 -2
  58. data/lib/plurimath/math/function/mod.rb +3 -3
  59. data/lib/plurimath/math/function/msgroup.rb +2 -2
  60. data/lib/plurimath/math/function/msline.rb +2 -2
  61. data/lib/plurimath/math/function/multiscript.rb +4 -4
  62. data/lib/plurimath/math/function/norm.rb +2 -2
  63. data/lib/plurimath/math/function/obrace.rb +35 -28
  64. data/lib/plurimath/math/function/oint.rb +4 -4
  65. data/lib/plurimath/math/function/over.rb +3 -3
  66. data/lib/plurimath/math/function/overset.rb +8 -3
  67. data/lib/plurimath/math/function/power.rb +3 -3
  68. data/lib/plurimath/math/function/power_base.rb +8 -8
  69. data/lib/plurimath/math/function/prod.rb +4 -4
  70. data/lib/plurimath/math/function/right.rb +1 -1
  71. data/lib/plurimath/math/function/root.rb +3 -3
  72. data/lib/plurimath/math/function/rule.rb +1 -1
  73. data/lib/plurimath/math/function/scarries.rb +2 -2
  74. data/lib/plurimath/math/function/semantics.rb +2 -2
  75. data/lib/plurimath/math/function/sqrt.rb +2 -2
  76. data/lib/plurimath/math/function/stackrel.rb +3 -3
  77. data/lib/plurimath/math/function/substack.rb +3 -3
  78. data/lib/plurimath/math/function/sum.rb +14 -19
  79. data/lib/plurimath/math/function/sup.rb +2 -2
  80. data/lib/plurimath/math/function/table.rb +7 -7
  81. data/lib/plurimath/math/function/td.rb +2 -2
  82. data/lib/plurimath/math/function/ternary_function.rb +7 -3
  83. data/lib/plurimath/math/function/text.rb +6 -5
  84. data/lib/plurimath/math/function/tilde.rb +22 -4
  85. data/lib/plurimath/math/function/tr.rb +2 -2
  86. data/lib/plurimath/math/function/ubrace.rb +23 -23
  87. data/lib/plurimath/math/function/ul.rb +50 -20
  88. data/lib/plurimath/math/function/unary_function.rb +7 -5
  89. data/lib/plurimath/math/function/underover.rb +10 -5
  90. data/lib/plurimath/math/function/underset.rb +8 -3
  91. data/lib/plurimath/math/function/vec.rb +20 -5
  92. data/lib/plurimath/math/number.rb +6 -2
  93. data/lib/plurimath/math/symbol.rb +6 -2
  94. data/lib/plurimath/math.rb +1 -0
  95. data/lib/plurimath/mathml/constants.rb +9 -1
  96. data/lib/plurimath/mathml/parser.rb +3 -1
  97. data/lib/plurimath/mathml/transform.rb +51 -22
  98. data/lib/plurimath/omml/parser.rb +24 -1
  99. data/lib/plurimath/omml/transform.rb +43 -36
  100. data/lib/plurimath/utility.rb +114 -9
  101. data/lib/plurimath/version.rb +1 -1
  102. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d50026941bd556b94051c14a61a081ad96dbf839ed1aa324a9451382ef512e8
4
- data.tar.gz: 40bf633bf5c0286daa011bf80d90baa2d522b18b9e545035d5dd6c32593792db
3
+ metadata.gz: 0ae20aeedcb99f6b913e591de0bf18624aae42c750df4ea706d90a6c47be4193
4
+ data.tar.gz: d1e9513bd715e585b57fffc72f1c0a6e163b6ac7ea4d270fe2e8323301f89036
5
5
  SHA512:
6
- metadata.gz: 8cf6f394801e567d2a7b482a14fc4da5e3b4c19515ce549a00fc9c247ce4d26c565dc5ff72586648cd30c51c0361f40808fb1117ed408bd9c319156622b34640
7
- data.tar.gz: 65d1590db64f33f620ad438ae2d328eb1fe9a6bffeee9a427dba9f782bdc9b429ed5c54e9892ade8c59894ddd57d2bcc6680a4b7cb1b9cee26c67c0cab1b05d2
6
+ metadata.gz: 6532186819c4523f46d6dc3503df5b88972f5c68cb54a3bd3e7ff66a1d8bd6d8b4346eac33a0ef2504bfcb4a1f813eb7130e9bb55b8196e3b2878b0733c7dad0
7
+ data.tar.gz: c9cbda12a71c9e0e57c04a92737945eef6ff79a6cbc35c3e0bdc7b0eddc0443af0e8614bd5d803db64de7e036b385324fe5f0c91a5faa3c601886d63eade5325
@@ -7,8 +7,8 @@ module Plurimath
7
7
  self.class.name.split("::").last.downcase
8
8
  end
9
9
 
10
- def insert_t_tag
11
- Array(to_omml_without_math_tag)
10
+ def insert_t_tag(display_style)
11
+ Array(to_omml_without_math_tag(display_style))
12
12
  end
13
13
 
14
14
  def tag_name
@@ -29,13 +29,13 @@ module Plurimath
29
29
  wrapper_tag << r_tag
30
30
  end
31
31
 
32
- def omml_parameter(field, tag_name: , namespace: "m")
32
+ def omml_parameter(field, display_style, tag_name: , namespace: "m")
33
33
  tag = Utility.ox_element(tag_name, namespace: namespace)
34
34
  return empty_tag(tag) unless field
35
35
 
36
36
  Utility.update_nodes(
37
37
  tag,
38
- field&.insert_t_tag,
38
+ field&.insert_t_tag(display_style),
39
39
  )
40
40
  end
41
41
 
@@ -52,6 +52,18 @@ module Plurimath
52
52
  r_tag << (Utility.ox_element("t", namespace: "m") << string)
53
53
  Array(r_tag)
54
54
  end
55
+
56
+ def extractable?
57
+ false
58
+ end
59
+
60
+ def extract_class_from_text
61
+ ""
62
+ end
63
+
64
+ def font_style_t_tag(display_style)
65
+ to_omml_without_math_tag(display_style)
66
+ end
55
67
  end
56
68
  end
57
69
  end
@@ -8,13 +8,13 @@ module Plurimath
8
8
  def initialize(
9
9
  value = [],
10
10
  left_right_wrapper = true,
11
- displaystyle: true,
11
+ display_style: true,
12
12
  input_string: nil
13
13
  )
14
14
  @value = value.is_a?(Array) ? value : [value]
15
15
  left_right_wrapper = false if @value.first.is_a?(Function::Left)
16
16
  @left_right_wrapper = left_right_wrapper
17
- @displaystyle = displaystyle
17
+ @displaystyle = boolean_display_style(display_style)
18
18
  end
19
19
 
20
20
  def ==(object)
@@ -33,7 +33,7 @@ module Plurimath
33
33
  xmlns: "http://www.w3.org/1998/Math/MathML",
34
34
  display: "block",
35
35
  }
36
- style_attrs = { displaystyle: display_style }
36
+ style_attrs = { displaystyle: boolean_display_style(display_style) }
37
37
  math = Utility.ox_element("math", attributes: math_attrs)
38
38
  style = Utility.ox_element("mstyle", attributes: style_attrs)
39
39
  Utility.update_nodes(style, mathml_content)
@@ -91,39 +91,39 @@ module Plurimath
91
91
  }
92
92
  end
93
93
 
94
- def to_omml
94
+ def to_omml(display_style: displaystyle)
95
95
  para_element = Utility.ox_element(
96
96
  "oMathPara",
97
97
  attributes: omml_math_attrs,
98
98
  namespace: "m",
99
99
  )
100
100
  math_element = Utility.ox_element("oMath", namespace: "m")
101
- Utility.update_nodes(math_element, omml_content)
102
- Utility.update_nodes(para_element, Array(math_element))
101
+ content = omml_content(boolean_display_style(display_style))
102
+ para_element << Utility.update_nodes(math_element, content)
103
103
  Ox.dump(para_element, indent: 2).gsub("&amp;", "&").lstrip
104
104
  rescue
105
105
  parse_error!(:omml)
106
106
  end
107
107
 
108
- def omml_content
109
- value&.map(&:insert_t_tag)
108
+ def omml_content(display_style)
109
+ value&.map { |val| val.insert_t_tag(display_style) }
110
110
  end
111
111
 
112
- def to_omml_without_math_tag
113
- return nary_tag if nary_tag_able?
112
+ def to_omml_without_math_tag(display_style)
113
+ return nary_tag(display_style) if nary_tag_able?(display_style)
114
114
 
115
- omml_content
115
+ omml_content(display_style)
116
116
  end
117
117
 
118
- def nary_tag
119
- nary_tag = Utility.ox_element("nary", namespace: "m")
118
+ def nary_tag(display_style)
119
+ nary_element = Utility.ox_element("nary", namespace: "m")
120
120
  e_tag = Utility.ox_element("e", namespace: "m")
121
- Utility.update_nodes(e_tag, value.last.insert_t_tag)
121
+ Utility.update_nodes(e_tag, value.last.insert_t_tag(display_style))
122
122
  Utility.update_nodes(
123
- nary_tag,
124
- (value.first.omml_nary_tag << e_tag),
123
+ nary_element,
124
+ (value.first.omml_nary_tag(display_style) << e_tag),
125
125
  )
126
- [nary_tag]
126
+ [nary_element]
127
127
  end
128
128
 
129
129
  def extract_class_from_text
@@ -136,12 +136,12 @@ module Plurimath
136
136
  value.first.nary_attr_value
137
137
  end
138
138
 
139
- def nary_tag_able?
139
+ def nary_tag_able?(display_style)
140
140
  value.length == 2 &&
141
141
  ["underover", "powerbase"].include?(value&.first&.class_name) &&
142
142
  (
143
- value&.first&.parameter_one&.to_omml_without_math_tag&.length == 1 ||
144
- value&.first&.parameter_one.to_omml_without_math_tag.match?(/^&#x\w*\d*;$/)
143
+ value&.first&.parameter_one&.to_omml_without_math_tag(display_style)&.length == 1 ||
144
+ value&.first&.parameter_one.to_omml_without_math_tag(display_style).match?(/^&#x\w*\d*;$/)
145
145
  )
146
146
  end
147
147
 
@@ -151,6 +151,10 @@ module Plurimath
151
151
 
152
152
  protected
153
153
 
154
+ def boolean_display_style(display_style = displaystyle)
155
+ YAML.load(display_style.to_s)
156
+ end
157
+
154
158
  def parse_error!(type)
155
159
  Math.parse_error!(input_string, type)
156
160
  end
@@ -15,10 +15,10 @@ module Plurimath
15
15
  )
16
16
  end
17
17
 
18
- def to_omml_without_math_tag
18
+ def to_omml_without_math_tag(display_style)
19
19
  md = (Utility.ox_element("d", namespace: "m") << mdpr_tag)
20
20
  me = Utility.ox_element("e", namespace: "m")
21
- Utility.update_nodes(me, omml_value)
21
+ Utility.update_nodes(me, omml_value(display_style))
22
22
  Utility.update_nodes(md, Array(me))
23
23
  [md]
24
24
  end
@@ -1,43 +1,74 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "unary_function"
3
+ require_relative "binary_function"
4
4
 
5
5
  module Plurimath
6
6
  module Math
7
7
  module Function
8
- class Bar < UnaryFunction
8
+ class Bar < BinaryFunction
9
+ def to_asciimath
10
+ first_value = "(#{parameter_one.to_asciimath})" if parameter_one
11
+ "bar#{first_value}"
12
+ end
13
+
9
14
  def to_latex
10
15
  first_value = "{#{parameter_one.to_latex}}" if parameter_one
11
16
  "\\overline#{first_value}"
12
17
  end
13
18
 
14
19
  def to_mathml_without_math_tag
15
- first_value = parameter_one&.to_mathml_without_math_tag
20
+ mo_tag = Utility.ox_element("mo") << "&#xaf;"
21
+ return mo_tag unless parameter_one
22
+
23
+ mover_tag = Utility.ox_element("mover")
24
+ mover_tag.attributes.merge!(parameter_two) if parameter_two && !parameter_two.empty?
25
+ Utility.update_nodes(
26
+ mover_tag,
27
+ [
28
+ parameter_one&.to_mathml_without_math_tag,
29
+ mo_tag,
30
+ ],
31
+ )
32
+ end
33
+
34
+ def to_omml_without_math_tag(display_style)
35
+ return r_element("&#xaf;", rpr_tag: false) unless all_values_exist?
36
+
37
+ parameter_two && parameter_two[:accent] ? acc_tag(display_style) : bar_tag(display_style)
38
+ end
39
+
40
+ def swap_class
41
+ Ul.new(parameter_one, parameter_two)
42
+ end
43
+
44
+ protected
45
+
46
+ def acc_tag(display_style)
47
+ acc = Utility.ox_element("acc", namespace: "m")
48
+ chr = Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "‾" } )
49
+ acc_pr = (Utility.ox_element("accPr", namespace: "m") << chr)
16
50
  Utility.update_nodes(
17
- Utility.ox_element("mover"),
51
+ acc,
18
52
  [
19
- first_value,
20
- Utility.ox_element("mo") << "&#xaf;",
53
+ acc_pr,
54
+ omml_parameter(parameter_one, display_style, tag_name: "e"),
21
55
  ],
22
56
  )
57
+ [acc]
23
58
  end
24
59
 
25
- def to_omml_without_math_tag
60
+ def bar_tag(display_style)
26
61
  bar = Utility.ox_element("bar", namespace: "m")
27
- me = Utility.ox_element("e", namespace: "m")
28
- Utility.update_nodes(me, omml_value) if parameter_one
29
62
  Utility.update_nodes(
30
63
  bar,
31
64
  [
32
65
  bar_pr,
33
- me,
66
+ omml_parameter(parameter_one, display_style, tag_name: "e", namespace: "m"),
34
67
  ],
35
68
  )
36
69
  [bar]
37
70
  end
38
71
 
39
- protected
40
-
41
72
  def bar_pr
42
73
  attrs = { "m:val": "top" }
43
74
  barpr = Utility.ox_element("barPr", namespace: "m")
@@ -34,7 +34,7 @@ module Plurimath
34
34
  "#{first_value}#{second_value}"
35
35
  end
36
36
 
37
- def to_omml_without_math_tag
37
+ def to_omml_without_math_tag(display_style)
38
38
  ssub_element = Utility.ox_element("sSub", namespace: "m")
39
39
  subpr_element = Utility.ox_element("sSubPr", namespace: "m")
40
40
  subpr_element << Utility.pr_element("ctrl", true, namespace: "m")
@@ -42,8 +42,8 @@ module Plurimath
42
42
  ssub_element,
43
43
  [
44
44
  subpr_element,
45
- omml_parameter(parameter_one, tag_name: "e"),
46
- omml_parameter(parameter_two, tag_name: "sub"),
45
+ omml_parameter(parameter_one, display_style, tag_name: "e"),
46
+ omml_parameter(parameter_two, display_style, tag_name: "sub"),
47
47
  ],
48
48
  )
49
49
  [ssub_element]
@@ -49,13 +49,17 @@ module Plurimath
49
49
  "#{first_value}#{second_value}"
50
50
  end
51
51
 
52
- def to_omml_without_math_tag
52
+ def to_omml_without_math_tag(display_style)
53
53
  r_tag = Utility.ox_element("r", namespace: "m")
54
- Utility.update_nodes(r_tag, [parameter_one.insert_t_tag]) if parameter_one
55
- Utility.update_nodes(r_tag, [parameter_two.insert_t_tag]) if parameter_two
54
+ Utility.update_nodes(r_tag, [parameter_one.insert_t_tag(display_style)]) if parameter_one
55
+ Utility.update_nodes(r_tag, [parameter_two.insert_t_tag(display_style)]) if parameter_two
56
56
  [r_tag]
57
57
  end
58
58
 
59
+ def all_values_exist?
60
+ !(parameter_one.nil? && parameter_two.nil?)
61
+ end
62
+
59
63
  protected
60
64
 
61
65
  def latex_wrapped(field)
@@ -82,18 +86,20 @@ module Plurimath
82
86
  wrapper_tag << r_tag
83
87
  end
84
88
 
85
- def all_values_exist?
86
- !(parameter_one.nil? && parameter_two.nil?)
87
- end
88
-
89
- def underover
89
+ def underover(display_style)
90
90
  return r_element(class_name, rpr_tag: false) unless all_values_exist?
91
91
 
92
92
  first_value = Symbol.new(class_name)
93
+ if !display_style
94
+ power_base = PowerBase.new(first_value, parameter_one, parameter_two)
95
+ return power_base.to_omml_without_math_tag(display_style)
96
+ end
97
+
93
98
  overset = Overset.new(first_value, parameter_two)
94
- return Array(overset.to_omml_without_math_tag) unless parameter_one
99
+ return Array(overset.to_omml_without_math_tag(display_style)) unless parameter_one
95
100
 
96
- Array(Underset.new(overset, parameter_one)&.to_omml_without_math_tag)
101
+ underset = Underset.new(overset, parameter_one)
102
+ Array(underset.to_omml_without_math_tag(display_style))
97
103
  end
98
104
  end
99
105
  end
@@ -15,8 +15,8 @@ module Plurimath
15
15
  Utility.update_nodes(cancel_tag, [first_value])
16
16
  end
17
17
 
18
- def to_omml_without_math_tag
19
- omml_value
18
+ def to_omml_without_math_tag(display_style)
19
+ omml_value(display_style)
20
20
  end
21
21
  end
22
22
  end
@@ -20,11 +20,16 @@ module Plurimath
20
20
  )
21
21
  end
22
22
 
23
- def to_omml_without_math_tag
23
+ def to_omml_without_math_tag(display_style)
24
24
  lceil = Symbol.new("⌈")
25
25
  rceil = Symbol.new("⌉")
26
26
  fenced = Fenced.new(lceil, Array(parameter_one), rceil)
27
- Array(fenced.to_omml_without_math_tag)
27
+ Array(fenced.to_omml_without_math_tag(display_style))
28
+ end
29
+
30
+ def to_html
31
+ first_value = "<i>#{parameter_one.to_html}</i>" if parameter_one
32
+ "<i>&#x2308;</i>#{first_value}<i>&#x2309;</i>"
28
33
  end
29
34
  end
30
35
  end
@@ -28,8 +28,8 @@ module Plurimath
28
28
  "{\\#{class_name}{#{first_value}} #{second_value}}"
29
29
  end
30
30
 
31
- def to_omml_without_math_tag
32
- Array(parameter_two.insert_t_tag)
31
+ def to_omml_without_math_tag(display_style)
32
+ Array(parameter_two.insert_t_tag(display_style))
33
33
  end
34
34
  end
35
35
  end
@@ -14,18 +14,16 @@ module Plurimath
14
14
  )
15
15
  end
16
16
 
17
- def to_omml_without_math_tag
18
- acc_tag = Utility.ox_element("acc", namespace: "m")
19
- acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
20
- acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": ".." }))
21
- Utility.update_nodes(
22
- acc_tag,
23
- [
24
- acc_pr_tag,
25
- omml_parameter(parameter_one, tag_name: "e"),
26
- ],
27
- )
28
- [acc_tag]
17
+ def to_omml_without_math_tag(display_style)
18
+ return r_element("..", rpr_tag: false) unless parameter_one
19
+
20
+ symbol = Symbol.new("..")
21
+ Overset.new(parameter_one, symbol).to_omml_without_math_tag(true)
22
+ end
23
+
24
+ def to_html
25
+ first_value = "<i>#{parameter_one.to_html}</i>" if parameter_one
26
+ "#{first_value}<i>..</i>"
29
27
  end
30
28
  end
31
29
  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("deg"), omml_value]
13
+ def to_omml_without_math_tag(display_style)
14
+ [r_element("deg", 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("det"), omml_value]
13
+ def to_omml_without_math_tag(display_style)
14
+ [r_element("det", 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("dim"), omml_value]
13
+ def to_omml_without_math_tag(display_style)
14
+ [r_element("dim", rpr_tag: false), omml_value(display_style)]
15
15
  end
16
16
  end
17
17
  end
@@ -1,15 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "unary_function"
3
+ require_relative "binary_function"
4
4
 
5
5
  module Plurimath
6
6
  module Math
7
7
  module Function
8
- class Dot < UnaryFunction
8
+ class Dot < BinaryFunction
9
9
  def to_mathml_without_math_tag
10
+ dot_tag = (Utility.ox_element("mo") << ".")
11
+ return dot_tag unless all_values_exist?
12
+
10
13
  first_value = parameter_one&.to_mathml_without_math_tag
11
14
  dot_tag = (Utility.ox_element("mo") << ".")
12
15
  over_tag = Utility.ox_element("mover")
16
+ over_tag.attributes.merge!({ accent: parameter_two[:accent] }) if parameter_two
13
17
  Utility.update_nodes(
14
18
  over_tag,
15
19
  [
@@ -19,7 +23,20 @@ module Plurimath
19
23
  )
20
24
  end
21
25
 
22
- def to_omml_without_math_tag
26
+ def to_omml_without_math_tag(display_style)
27
+ return r_element(".", rpr_tag: false) unless all_values_exist?
28
+
29
+ if parameter_two && parameter_two[:accent]
30
+ acc_tag(display_style)
31
+ else
32
+ symbol = Symbol.new(".")
33
+ Overset.new(parameter_one, symbol).to_omml_without_math_tag(true)
34
+ end
35
+ end
36
+
37
+ protected
38
+
39
+ def acc_tag(display_style)
23
40
  acc_tag = Utility.ox_element("acc", namespace: "m")
24
41
  acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
25
42
  acc_pr_tag << Utility.ox_element(
@@ -31,7 +48,7 @@ module Plurimath
31
48
  acc_tag,
32
49
  [
33
50
  acc_pr_tag,
34
- omml_parameter(parameter_one, tag_name: "e"),
51
+ omml_parameter(parameter_one, display_style, tag_name: "e"),
35
52
  ],
36
53
  )
37
54
  [acc_tag]
@@ -10,8 +10,8 @@ module Plurimath
10
10
  false
11
11
  end
12
12
 
13
- def to_omml_without_math_tag
14
- [r_element("exp"), omml_value]
13
+ def to_omml_without_math_tag(display_style)
14
+ [r_element("exp", rpr_tag: false), omml_value(display_style)]
15
15
  end
16
16
  end
17
17
  end
@@ -38,7 +38,7 @@ module Plurimath
38
38
  "#{first_value} #{fenced_value} #{second_value}"
39
39
  end
40
40
 
41
- def to_omml_without_math_tag
41
+ def to_omml_without_math_tag(display_style)
42
42
  d = Utility.ox_element("d", namespace: "m")
43
43
  dpr = Utility.ox_element("dPr", namespace: "m")
44
44
  first_value(dpr)
@@ -50,6 +50,7 @@ module Plurimath
50
50
  dpr,
51
51
  omml_parameter(
52
52
  Formula.new(Array(parameter_two)),
53
+ display_style,
53
54
  tag_name: "e",
54
55
  ),
55
56
  ],
@@ -22,10 +22,10 @@ module Plurimath
22
22
  )
23
23
  end
24
24
 
25
- def to_omml_without_math_tag
25
+ def to_omml_without_math_tag(display_style)
26
26
  [
27
27
  r_element("⌊"),
28
- omml_value,
28
+ omml_value(display_style),
29
29
  r_element("⌋"),
30
30
  ]
31
31
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../font_style"
4
+
5
+ module Plurimath
6
+ module Math
7
+ module Function
8
+ class FontStyle
9
+ class BoldFraktur < FontStyle
10
+ def to_omml_without_math_tag(display_style)
11
+ font_styles(display_style, sty: "b", scr: "fraktur")
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../font_style"
4
+
5
+ module Plurimath
6
+ module Math
7
+ module Function
8
+ class FontStyle
9
+ class BoldItalic < FontStyle
10
+ def to_omml_without_math_tag(display_style)
11
+ font_styles(display_style, sty: "bi")
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../font_style"
4
+
5
+ module Plurimath
6
+ module Math
7
+ module Function
8
+ class FontStyle
9
+ class BoldSansSerif < FontStyle
10
+ def to_omml_without_math_tag(display_style)
11
+ font_styles(display_style, sty: "b", scr: "sans-serif")
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../font_style"
4
+
5
+ module Plurimath
6
+ module Math
7
+ module Function
8
+ class FontStyle
9
+ class BoldScript < FontStyle
10
+ def to_omml_without_math_tag(display_style)
11
+ font_styles(display_style, sty: "b", scr: "script")
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -29,6 +29,10 @@ module Plurimath
29
29
  [parameter_one&.to_mathml_without_math_tag],
30
30
  )
31
31
  end
32
+
33
+ def to_omml_without_math_tag(display_style)
34
+ font_styles(display_style, sty: "b")
35
+ end
32
36
  end
33
37
  end
34
38
  end
@@ -29,6 +29,10 @@ module Plurimath
29
29
  [parameter_one&.to_mathml_without_math_tag],
30
30
  )
31
31
  end
32
+
33
+ def to_omml_without_math_tag(display_style)
34
+ font_styles(display_style, sty: nil, scr: "double-struck")
35
+ end
32
36
  end
33
37
  end
34
38
  end
@@ -29,6 +29,10 @@ module Plurimath
29
29
  [parameter_one&.to_mathml_without_math_tag],
30
30
  )
31
31
  end
32
+
33
+ def to_omml_without_math_tag(display_style)
34
+ font_styles(display_style, scr: "fraktur")
35
+ end
32
36
  end
33
37
  end
34
38
  end
@@ -29,6 +29,10 @@ module Plurimath
29
29
  [parameter_one&.to_mathml_without_math_tag],
30
30
  )
31
31
  end
32
+
33
+ def to_omml_without_math_tag(display_style)
34
+ font_styles(display_style, sty: "i")
35
+ end
32
36
  end
33
37
  end
34
38
  end