plurimath 0.3.8 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/plurimath/asciimath/transform.rb +17 -0
- data/lib/plurimath/math/core.rb +20 -4
- data/lib/plurimath/math/formula.rb +42 -25
- data/lib/plurimath/math/function/abs.rb +2 -2
- data/lib/plurimath/math/function/bar.rb +43 -12
- data/lib/plurimath/math/function/base.rb +3 -3
- data/lib/plurimath/math/function/binary_function.rb +21 -5
- data/lib/plurimath/math/function/cancel.rb +2 -2
- data/lib/plurimath/math/function/ceil.rb +7 -2
- data/lib/plurimath/math/function/color.rb +2 -2
- data/lib/plurimath/math/function/ddot.rb +10 -12
- data/lib/plurimath/math/function/deg.rb +2 -2
- data/lib/plurimath/math/function/det.rb +2 -2
- data/lib/plurimath/math/function/dim.rb +2 -2
- data/lib/plurimath/math/function/dot.rb +21 -4
- data/lib/plurimath/math/function/exp.rb +2 -2
- data/lib/plurimath/math/function/fenced.rb +2 -1
- data/lib/plurimath/math/function/floor.rb +2 -2
- data/lib/plurimath/math/function/font_style/bold-fraktur.rb +17 -0
- data/lib/plurimath/math/function/font_style/bold-italic.rb +17 -0
- data/lib/plurimath/math/function/font_style/bold-sans-serif.rb +17 -0
- data/lib/plurimath/math/function/font_style/bold-script.rb +17 -0
- data/lib/plurimath/math/function/font_style/bold.rb +4 -0
- data/lib/plurimath/math/function/font_style/double_struck.rb +4 -0
- data/lib/plurimath/math/function/font_style/fraktur.rb +4 -0
- data/lib/plurimath/math/function/font_style/italic.rb +4 -0
- data/lib/plurimath/math/function/font_style/monospace.rb +4 -0
- data/lib/plurimath/math/function/font_style/normal.rb +4 -0
- data/lib/plurimath/math/function/font_style/sans-serif-bold-italic.rb +17 -0
- data/lib/plurimath/math/function/font_style/sans-serif-italic.rb +17 -0
- data/lib/plurimath/math/function/font_style/sans-serif.rb +4 -0
- data/lib/plurimath/math/function/font_style/script.rb +4 -0
- data/lib/plurimath/math/function/font_style.rb +22 -4
- data/lib/plurimath/math/function/frac.rb +3 -3
- data/lib/plurimath/math/function/gcd.rb +2 -2
- data/lib/plurimath/math/function/glb.rb +2 -2
- data/lib/plurimath/math/function/hat.rb +37 -11
- data/lib/plurimath/math/function/hom.rb +2 -2
- data/lib/plurimath/math/function/inf.rb +3 -9
- data/lib/plurimath/math/function/int.rb +4 -4
- data/lib/plurimath/math/function/ker.rb +2 -2
- data/lib/plurimath/math/function/lcm.rb +2 -2
- data/lib/plurimath/math/function/left.rb +1 -1
- data/lib/plurimath/math/function/lg.rb +2 -2
- data/lib/plurimath/math/function/lim.rb +2 -8
- data/lib/plurimath/math/function/liminf.rb +2 -2
- data/lib/plurimath/math/function/limits.rb +4 -4
- data/lib/plurimath/math/function/limsup.rb +2 -2
- data/lib/plurimath/math/function/ln.rb +2 -2
- data/lib/plurimath/math/function/log.rb +5 -3
- data/lib/plurimath/math/function/longdiv.rb +2 -2
- data/lib/plurimath/math/function/lub.rb +2 -2
- data/lib/plurimath/math/function/max.rb +2 -2
- data/lib/plurimath/math/function/mbox.rb +2 -2
- data/lib/plurimath/math/function/menclose.rb +2 -2
- data/lib/plurimath/math/function/merror.rb +1 -1
- data/lib/plurimath/math/function/min.rb +2 -2
- data/lib/plurimath/math/function/mod.rb +3 -3
- data/lib/plurimath/math/function/msgroup.rb +2 -2
- data/lib/plurimath/math/function/msline.rb +2 -2
- data/lib/plurimath/math/function/multiscript.rb +4 -4
- data/lib/plurimath/math/function/norm.rb +2 -2
- data/lib/plurimath/math/function/obrace.rb +35 -28
- data/lib/plurimath/math/function/oint.rb +15 -16
- data/lib/plurimath/math/function/over.rb +3 -3
- data/lib/plurimath/math/function/overset.rb +8 -3
- data/lib/plurimath/math/function/power.rb +3 -3
- data/lib/plurimath/math/function/power_base.rb +10 -8
- data/lib/plurimath/math/function/prod.rb +8 -4
- data/lib/plurimath/math/function/right.rb +1 -1
- data/lib/plurimath/math/function/root.rb +3 -3
- data/lib/plurimath/math/function/rule.rb +1 -1
- data/lib/plurimath/math/function/scarries.rb +2 -2
- data/lib/plurimath/math/function/semantics.rb +2 -2
- data/lib/plurimath/math/function/sqrt.rb +2 -2
- data/lib/plurimath/math/function/stackrel.rb +3 -3
- data/lib/plurimath/math/function/substack.rb +3 -3
- data/lib/plurimath/math/function/sum.rb +22 -19
- data/lib/plurimath/math/function/sup.rb +2 -2
- data/lib/plurimath/math/function/table.rb +7 -11
- data/lib/plurimath/math/function/td.rb +2 -2
- data/lib/plurimath/math/function/ternary_function.rb +11 -0
- data/lib/plurimath/math/function/text.rb +6 -5
- data/lib/plurimath/math/function/tilde.rb +22 -4
- data/lib/plurimath/math/function/tr.rb +2 -2
- data/lib/plurimath/math/function/ubrace.rb +27 -23
- data/lib/plurimath/math/function/ul.rb +50 -20
- data/lib/plurimath/math/function/unary_function.rb +7 -5
- data/lib/plurimath/math/function/underover.rb +10 -8
- data/lib/plurimath/math/function/underset.rb +8 -3
- data/lib/plurimath/math/function/vec.rb +20 -5
- data/lib/plurimath/math/number.rb +6 -2
- data/lib/plurimath/math/symbol.rb +14 -2
- data/lib/plurimath/math.rb +4 -1
- data/lib/plurimath/mathml/constants.rb +9 -1
- data/lib/plurimath/mathml/parser.rb +4 -2
- data/lib/plurimath/mathml/transform.rb +51 -22
- data/lib/plurimath/omml/parser.rb +24 -1
- data/lib/plurimath/omml/transform.rb +43 -36
- data/lib/plurimath/utility.rb +114 -9
- data/lib/plurimath/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ae20aeedcb99f6b913e591de0bf18624aae42c750df4ea706d90a6c47be4193
|
4
|
+
data.tar.gz: d1e9513bd715e585b57fffc72f1c0a6e163b6ac7ea4d270fe2e8323301f89036
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6532186819c4523f46d6dc3503df5b88972f5c68cb54a3bd3e7ff66a1d8bd6d8b4346eac33a0ef2504bfcb4a1f813eb7130e9bb55b8196e3b2878b0733c7dad0
|
7
|
+
data.tar.gz: c9cbda12a71c9e0e57c04a92737945eef6ff79a6cbc35c3e0bdc7b0eddc0443af0e8614bd5d803db64de7e036b385324fe5f0c91a5faa3c601886d63eade5325
|
@@ -766,6 +766,18 @@ module Plurimath
|
|
766
766
|
)
|
767
767
|
end
|
768
768
|
|
769
|
+
rule(ternary_class: simple(:function),
|
770
|
+
base_value: simple(:base),
|
771
|
+
power_value: simple(:power),
|
772
|
+
third_value: sequence(:third)) do
|
773
|
+
third_value = third.is_a?(Slice) ? nil : third
|
774
|
+
Utility.get_class(function).new(
|
775
|
+
Utility.unfenced_value(base),
|
776
|
+
Utility.unfenced_value(power),
|
777
|
+
Utility.filter_values(third_value),
|
778
|
+
)
|
779
|
+
end
|
780
|
+
|
769
781
|
rule(unary_class: simple(:function),
|
770
782
|
intermediate_exp: simple(:int_exp)) do
|
771
783
|
first_value = if Utility::UNARY_CLASSES.include?(function)
|
@@ -821,6 +833,11 @@ module Plurimath
|
|
821
833
|
expr.insert(0, ternary)
|
822
834
|
end
|
823
835
|
|
836
|
+
rule(ternary: simple(:ternary),
|
837
|
+
left_right: simple(:left_right)) do
|
838
|
+
[ternary, left_right]
|
839
|
+
end
|
840
|
+
|
824
841
|
rule(unary_class: simple(:function),
|
825
842
|
text: simple(:text)) do
|
826
843
|
Utility.get_class(function).new(
|
data/lib/plurimath/math/core.rb
CHANGED
@@ -7,14 +7,18 @@ 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
|
15
15
|
"subsup"
|
16
16
|
end
|
17
17
|
|
18
|
+
def omml_tag_name
|
19
|
+
"subSup"
|
20
|
+
end
|
21
|
+
|
18
22
|
def nary_attr_value
|
19
23
|
""
|
20
24
|
end
|
@@ -25,13 +29,13 @@ module Plurimath
|
|
25
29
|
wrapper_tag << r_tag
|
26
30
|
end
|
27
31
|
|
28
|
-
def omml_parameter(field, tag_name: , namespace: "m")
|
32
|
+
def omml_parameter(field, display_style, tag_name: , namespace: "m")
|
29
33
|
tag = Utility.ox_element(tag_name, namespace: namespace)
|
30
34
|
return empty_tag(tag) unless field
|
31
35
|
|
32
36
|
Utility.update_nodes(
|
33
37
|
tag,
|
34
|
-
field&.insert_t_tag,
|
38
|
+
field&.insert_t_tag(display_style),
|
35
39
|
)
|
36
40
|
end
|
37
41
|
|
@@ -48,6 +52,18 @@ module Plurimath
|
|
48
52
|
r_tag << (Utility.ox_element("t", namespace: "m") << string)
|
49
53
|
Array(r_tag)
|
50
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
|
51
67
|
end
|
52
68
|
end
|
53
69
|
end
|
@@ -3,17 +3,18 @@
|
|
3
3
|
module Plurimath
|
4
4
|
module Math
|
5
5
|
class Formula < Core
|
6
|
-
attr_accessor :value, :left_right_wrapper, :displaystyle
|
6
|
+
attr_accessor :value, :left_right_wrapper, :displaystyle, :input_string
|
7
7
|
|
8
8
|
def initialize(
|
9
9
|
value = [],
|
10
10
|
left_right_wrapper = true,
|
11
|
-
|
11
|
+
display_style: true,
|
12
|
+
input_string: nil
|
12
13
|
)
|
13
14
|
@value = value.is_a?(Array) ? value : [value]
|
14
15
|
left_right_wrapper = false if @value.first.is_a?(Function::Left)
|
15
16
|
@left_right_wrapper = left_right_wrapper
|
16
|
-
@displaystyle =
|
17
|
+
@displaystyle = boolean_display_style(display_style)
|
17
18
|
end
|
18
19
|
|
19
20
|
def ==(object)
|
@@ -23,6 +24,8 @@ module Plurimath
|
|
23
24
|
|
24
25
|
def to_asciimath
|
25
26
|
value.map(&:to_asciimath).join(" ")
|
27
|
+
rescue
|
28
|
+
parse_error!(:asciimath)
|
26
29
|
end
|
27
30
|
|
28
31
|
def to_mathml(display_style: displaystyle)
|
@@ -30,12 +33,14 @@ module Plurimath
|
|
30
33
|
xmlns: "http://www.w3.org/1998/Math/MathML",
|
31
34
|
display: "block",
|
32
35
|
}
|
33
|
-
style_attrs = { displaystyle: display_style }
|
36
|
+
style_attrs = { displaystyle: boolean_display_style(display_style) }
|
34
37
|
math = Utility.ox_element("math", attributes: math_attrs)
|
35
38
|
style = Utility.ox_element("mstyle", attributes: style_attrs)
|
36
39
|
Utility.update_nodes(style, mathml_content)
|
37
40
|
Utility.update_nodes(math, [style])
|
38
41
|
Ox.dump(math, indent: 2).gsub("&", "&")
|
42
|
+
rescue
|
43
|
+
parse_error!(:mathml)
|
39
44
|
end
|
40
45
|
|
41
46
|
def to_mathml_without_math_tag
|
@@ -53,10 +58,14 @@ module Plurimath
|
|
53
58
|
|
54
59
|
def to_latex
|
55
60
|
value&.map(&:to_latex)&.join(" ")
|
61
|
+
rescue
|
62
|
+
parse_error!(:latex)
|
56
63
|
end
|
57
64
|
|
58
65
|
def to_html
|
59
66
|
value&.map(&:to_html)&.join(" ")
|
67
|
+
rescue
|
68
|
+
parse_error!(:html)
|
60
69
|
end
|
61
70
|
|
62
71
|
def omml_math_attrs
|
@@ -82,41 +91,39 @@ module Plurimath
|
|
82
91
|
}
|
83
92
|
end
|
84
93
|
|
85
|
-
def to_omml
|
94
|
+
def to_omml(display_style: displaystyle)
|
86
95
|
para_element = Utility.ox_element(
|
87
96
|
"oMathPara",
|
88
97
|
attributes: omml_math_attrs,
|
89
98
|
namespace: "m",
|
90
99
|
)
|
91
100
|
math_element = Utility.ox_element("oMath", namespace: "m")
|
92
|
-
|
93
|
-
Utility.update_nodes(
|
101
|
+
content = omml_content(boolean_display_style(display_style))
|
102
|
+
para_element << Utility.update_nodes(math_element, content)
|
94
103
|
Ox.dump(para_element, indent: 2).gsub("&", "&").lstrip
|
104
|
+
rescue
|
105
|
+
parse_error!(:omml)
|
95
106
|
end
|
96
107
|
|
97
|
-
def omml_content
|
98
|
-
value&.map(
|
108
|
+
def omml_content(display_style)
|
109
|
+
value&.map { |val| val.insert_t_tag(display_style) }
|
99
110
|
end
|
100
111
|
|
101
|
-
def to_omml_without_math_tag
|
102
|
-
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)
|
103
114
|
|
104
|
-
omml_content
|
115
|
+
omml_content(display_style)
|
105
116
|
end
|
106
117
|
|
107
|
-
def nary_tag
|
108
|
-
|
118
|
+
def nary_tag(display_style)
|
119
|
+
nary_element = Utility.ox_element("nary", namespace: "m")
|
109
120
|
e_tag = Utility.ox_element("e", namespace: "m")
|
110
|
-
Utility.update_nodes(e_tag, value.last.insert_t_tag)
|
121
|
+
Utility.update_nodes(e_tag, value.last.insert_t_tag(display_style))
|
111
122
|
Utility.update_nodes(
|
112
|
-
|
113
|
-
(value.first.omml_nary_tag << e_tag),
|
123
|
+
nary_element,
|
124
|
+
(value.first.omml_nary_tag(display_style) << e_tag),
|
114
125
|
)
|
115
|
-
[
|
116
|
-
end
|
117
|
-
|
118
|
-
def class_name
|
119
|
-
self.class.name.split("::").last.downcase
|
126
|
+
[nary_element]
|
120
127
|
end
|
121
128
|
|
122
129
|
def extract_class_from_text
|
@@ -129,18 +136,28 @@ module Plurimath
|
|
129
136
|
value.first.nary_attr_value
|
130
137
|
end
|
131
138
|
|
132
|
-
def nary_tag_able?
|
139
|
+
def nary_tag_able?(display_style)
|
133
140
|
value.length == 2 &&
|
134
141
|
["underover", "powerbase"].include?(value&.first&.class_name) &&
|
135
142
|
(
|
136
|
-
value&.first&.parameter_one&.to_omml_without_math_tag&.length == 1 ||
|
137
|
-
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*;$/)
|
138
145
|
)
|
139
146
|
end
|
140
147
|
|
141
148
|
def validate_function_formula
|
142
149
|
(value.none?(Function::Left) || value.none?(Function::Right))
|
143
150
|
end
|
151
|
+
|
152
|
+
protected
|
153
|
+
|
154
|
+
def boolean_display_style(display_style = displaystyle)
|
155
|
+
YAML.load(display_style.to_s)
|
156
|
+
end
|
157
|
+
|
158
|
+
def parse_error!(type)
|
159
|
+
Math.parse_error!(input_string, type)
|
160
|
+
end
|
144
161
|
end
|
145
162
|
end
|
146
163
|
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 "
|
3
|
+
require_relative "binary_function"
|
4
4
|
|
5
5
|
module Plurimath
|
6
6
|
module Math
|
7
7
|
module Function
|
8
|
-
class Bar <
|
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
|
-
|
20
|
+
mo_tag = Utility.ox_element("mo") << "¯"
|
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("¯", 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
|
-
|
51
|
+
acc,
|
18
52
|
[
|
19
|
-
|
20
|
-
|
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
|
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
|
-
|
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,8 +86,20 @@ module Plurimath
|
|
82
86
|
wrapper_tag << r_tag
|
83
87
|
end
|
84
88
|
|
85
|
-
def
|
86
|
-
|
89
|
+
def underover(display_style)
|
90
|
+
return r_element(class_name, rpr_tag: false) unless all_values_exist?
|
91
|
+
|
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
|
+
|
98
|
+
overset = Overset.new(first_value, parameter_two)
|
99
|
+
return Array(overset.to_omml_without_math_tag(display_style)) unless parameter_one
|
100
|
+
|
101
|
+
underset = Underset.new(overset, parameter_one)
|
102
|
+
Array(underset.to_omml_without_math_tag(display_style))
|
87
103
|
end
|
88
104
|
end
|
89
105
|
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>⌈</i>#{first_value}<i>⌉</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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
@@ -1,15 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "
|
3
|
+
require_relative "binary_function"
|
4
4
|
|
5
5
|
module Plurimath
|
6
6
|
module Math
|
7
7
|
module Function
|
8
|
-
class Dot <
|
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]
|
@@ -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
|
],
|
@@ -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
|