plurimath 0.3.9 → 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/math/core.rb +16 -4
- data/lib/plurimath/math/formula.rb +24 -20
- 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 +16 -10
- 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 +2 -2
- 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 -2
- 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 +4 -4
- 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 +8 -8
- data/lib/plurimath/math/function/prod.rb +4 -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 +14 -19
- data/lib/plurimath/math/function/sup.rb +2 -2
- data/lib/plurimath/math/function/table.rb +7 -7
- data/lib/plurimath/math/function/td.rb +2 -2
- data/lib/plurimath/math/function/ternary_function.rb +7 -3
- 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 +23 -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 -5
- 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 +6 -2
- data/lib/plurimath/math.rb +1 -0
- data/lib/plurimath/mathml/constants.rb +9 -1
- data/lib/plurimath/mathml/parser.rb +3 -1
- 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
@@ -1,11 +1,16 @@
|
|
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 Obrace <
|
8
|
+
class Obrace < BinaryFunction
|
9
|
+
def to_asciimath
|
10
|
+
first_value = "(#{parameter_one.to_asciimath})" if parameter_one
|
11
|
+
"obrace#{first_value}"
|
12
|
+
end
|
13
|
+
|
9
14
|
def to_latex
|
10
15
|
first_value = "{#{parameter_one.to_latex}}" if parameter_one
|
11
16
|
"\\overbrace#{first_value}"
|
@@ -13,46 +18,48 @@ module Plurimath
|
|
13
18
|
|
14
19
|
def to_mathml_without_math_tag
|
15
20
|
mo_tag = (Utility.ox_element("mo") << "⏞")
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
return mo_tag unless parameter_one
|
22
|
+
|
23
|
+
over_tag = Utility.ox_element("mover")
|
24
|
+
over_tag.attributes.merge!(parameter_two) if parameter_two && !parameter_two.empty?
|
25
|
+
Utility.update_nodes(
|
26
|
+
over_tag,
|
27
|
+
[
|
28
|
+
parameter_one.to_mathml_without_math_tag,
|
29
|
+
mo_tag,
|
30
|
+
],
|
31
|
+
)
|
23
32
|
end
|
24
33
|
|
25
34
|
def validate_function_formula
|
26
35
|
false
|
27
36
|
end
|
28
37
|
|
29
|
-
def to_omml_without_math_tag
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
[groupchr]
|
38
|
+
def to_omml_without_math_tag(display_style)
|
39
|
+
return r_element("⏞", rpr_tag: false) unless all_values_exist?
|
40
|
+
|
41
|
+
if parameter_two && parameter_two[:accent]
|
42
|
+
acc_tag(display_style)
|
43
|
+
else
|
44
|
+
symbol = Symbol.new("⏞")
|
45
|
+
Overset.new(parameter_one, symbol).to_omml_without_math_tag(true)
|
46
|
+
end
|
39
47
|
end
|
40
48
|
|
41
49
|
protected
|
42
50
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
pos = Utility.ox_element("pos", namespace: "m", attributes: { "m:val": "top" })
|
51
|
+
def acc_tag(display_style)
|
52
|
+
acc_tag = Utility.ox_element("acc", namespace: "m")
|
53
|
+
acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
|
54
|
+
acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "⏞" }))
|
48
55
|
Utility.update_nodes(
|
49
|
-
|
56
|
+
acc_tag,
|
50
57
|
[
|
51
|
-
|
52
|
-
|
53
|
-
vert_jc,
|
58
|
+
acc_pr_tag,
|
59
|
+
omml_parameter(parameter_one, display_style, tag_name: "e", namespace: "m"),
|
54
60
|
],
|
55
61
|
)
|
62
|
+
[acc_tag]
|
56
63
|
end
|
57
64
|
end
|
58
65
|
|
@@ -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>∏</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]
|
@@ -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]
|
@@ -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>∑</i>#{first_value}#{second_value}"
|
55
55
|
end
|
56
56
|
|
57
|
-
def to_omml_without_math_tag
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
r_tag = Utility.ox_element("r", namespace: "m")
|
72
|
-
t_tag = Utility.ox_element("t", namespace: "m")
|
73
|
-
r_tag << (t_tag << "∑")
|
74
|
-
[r_tag]
|
75
|
-
end
|
57
|
+
def to_omml_without_math_tag(display_style)
|
58
|
+
return r_element("∑", 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(
|
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(
|
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
|
@@ -51,6 +51,10 @@ module Plurimath
|
|
51
51
|
"#{first_value}#{second_value}#{third_value}"
|
52
52
|
end
|
53
53
|
|
54
|
+
def any_value_exist?
|
55
|
+
!(parameter_one.nil? || parameter_two.nil? || parameter_three.nil?)
|
56
|
+
end
|
57
|
+
|
54
58
|
protected
|
55
59
|
|
56
60
|
def latex_wrapped(field)
|
@@ -132,11 +136,11 @@ module Plurimath
|
|
132
136
|
Array(parameter.to_mathml_without_math_tag)
|
133
137
|
end
|
134
138
|
|
135
|
-
def underover
|
139
|
+
def underover(display_style)
|
136
140
|
overset = Overset.new(parameter_one, parameter_three)
|
137
|
-
return overset unless parameter_two
|
141
|
+
return overset.to_omml_without_math_tag(display_style) unless parameter_two
|
138
142
|
|
139
|
-
Underset.new(overset, parameter_two)&.to_omml_without_math_tag
|
143
|
+
Underset.new(overset, parameter_two)&.to_omml_without_math_tag(display_style)
|
140
144
|
end
|
141
145
|
end
|
142
146
|
end
|
@@ -27,15 +27,15 @@ module Plurimath
|
|
27
27
|
parse_text("html") || parameter_one
|
28
28
|
end
|
29
29
|
|
30
|
-
def to_omml_without_math_tag
|
30
|
+
def to_omml_without_math_tag(_display_style)
|
31
31
|
text = Utility.ox_element("t", namespace: "m")
|
32
32
|
text << (parse_text("omml") || parameter_one)
|
33
33
|
[text]
|
34
34
|
end
|
35
35
|
|
36
|
-
def insert_t_tag
|
36
|
+
def insert_t_tag(display_style)
|
37
37
|
r_tag = Utility.ox_element("r", namespace: "m")
|
38
|
-
Utility.update_nodes(r_tag, to_omml_without_math_tag)
|
38
|
+
Utility.update_nodes(r_tag, to_omml_without_math_tag(display_style))
|
39
39
|
[r_tag]
|
40
40
|
end
|
41
41
|
|
@@ -54,7 +54,8 @@ module Plurimath
|
|
54
54
|
html_value = first_value(lang).dup
|
55
55
|
html_value&.gsub!(PARSER_REGEX) do |_text|
|
56
56
|
last_match = Regexp.last_match
|
57
|
-
|
57
|
+
case lang
|
58
|
+
when "mathml", "html"
|
58
59
|
symbol_value(last_match[:unicode])
|
59
60
|
else
|
60
61
|
last_match[:unicode]
|
@@ -67,7 +68,7 @@ module Plurimath
|
|
67
68
|
if lang == "omml"
|
68
69
|
entities = HTMLEntities.new
|
69
70
|
entities.encode(
|
70
|
-
entities.decode(parameter_one),
|
71
|
+
entities.decode(parameter_one.gsub(/ /, " ")),
|
71
72
|
:named,
|
72
73
|
)
|
73
74
|
else
|
@@ -1,19 +1,37 @@
|
|
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 Tilde <
|
8
|
+
class Tilde < BinaryFunction
|
9
9
|
def to_mathml_without_math_tag
|
10
10
|
mover = Utility.ox_element("mover")
|
11
|
+
mover.attributes.merge!({ accent: parameter_two[:accent]}) if parameter_two
|
11
12
|
first_value = (Utility.ox_element("mo") << "~")
|
12
13
|
second_value = parameter_one.to_mathml_without_math_tag if parameter_one
|
13
14
|
Utility.update_nodes(mover, [second_value, first_value])
|
14
15
|
end
|
15
16
|
|
16
|
-
def to_omml_without_math_tag
|
17
|
+
def to_omml_without_math_tag(display_style)
|
18
|
+
return r_element("~", rpr_tag: false) unless all_values_exist?
|
19
|
+
|
20
|
+
if parameter_two && parameter_two[:accent]
|
21
|
+
acc_tag(display_style)
|
22
|
+
else
|
23
|
+
symbol = Symbol.new("~")
|
24
|
+
Overset.new(parameter_one, symbol).to_omml_without_math_tag(true)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def validate_function_formula
|
29
|
+
false
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
|
34
|
+
def acc_tag(display_style)
|
17
35
|
acc_tag = Utility.ox_element("acc", namespace: "m")
|
18
36
|
acc_pr_tag = Utility.ox_element("accPr", namespace: "m")
|
19
37
|
acc_pr_tag << (Utility.ox_element("chr", namespace: "m", attributes: { "m:val": "˜" }))
|
@@ -21,7 +39,7 @@ module Plurimath
|
|
21
39
|
acc_tag,
|
22
40
|
[
|
23
41
|
acc_pr_tag,
|
24
|
-
omml_parameter(parameter_one, tag_name: "e"),
|
42
|
+
omml_parameter(parameter_one, display_style, tag_name: "e"),
|
25
43
|
],
|
26
44
|
)
|
27
45
|
[acc_tag]
|
@@ -31,8 +31,8 @@ module Plurimath
|
|
31
31
|
"<tr>#{first_value}</tr>"
|
32
32
|
end
|
33
33
|
|
34
|
-
def to_omml_without_math_tag
|
35
|
-
omml_content = parameter_one&.map(
|
34
|
+
def to_omml_without_math_tag(display_style)
|
35
|
+
omml_content = parameter_one&.map { |obj| obj.to_omml_without_math_tag(display_style) }
|
36
36
|
if parameter_one.count.eql?(1)
|
37
37
|
omml_content
|
38
38
|
else
|