plurimath 0.11.5 → 0.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/plurimath/asciimath/utility.rb +50 -0
- data/lib/plurimath/asciimath.rb +1 -0
- data/lib/plurimath/formatter/numbers/mathml_renderer.rb +15 -15
- data/lib/plurimath/formatter/numbers/omml_renderer.rb +19 -19
- data/lib/plurimath/html/utility.rb +18 -0
- data/lib/plurimath/html.rb +1 -0
- data/lib/plurimath/latex/utility.rb +118 -0
- data/lib/plurimath/latex.rb +1 -0
- data/lib/plurimath/math/core.rb +12 -12
- data/lib/plurimath/math/formula.rb +10 -10
- data/lib/plurimath/math/function/abs.rb +3 -3
- data/lib/plurimath/math/function/bar.rb +14 -14
- data/lib/plurimath/math/function/base.rb +15 -7
- data/lib/plurimath/math/function/binary_function.rb +7 -7
- data/lib/plurimath/math/function/cancel.rb +2 -2
- data/lib/plurimath/math/function/ceil.rb +1 -1
- data/lib/plurimath/math/function/color.rb +2 -2
- data/lib/plurimath/math/function/ddot.rb +3 -3
- data/lib/plurimath/math/function/dot.rb +8 -8
- data/lib/plurimath/math/function/fenced.rb +8 -8
- data/lib/plurimath/math/function/floor.rb +1 -1
- data/lib/plurimath/math/function/font_style/bold.rb +2 -2
- data/lib/plurimath/math/function/font_style/double_struck.rb +2 -2
- data/lib/plurimath/math/function/font_style/fraktur.rb +2 -2
- data/lib/plurimath/math/function/font_style/italic.rb +2 -2
- data/lib/plurimath/math/function/font_style/monospace.rb +2 -2
- data/lib/plurimath/math/function/font_style/normal.rb +2 -2
- data/lib/plurimath/math/function/font_style/sans-serif.rb +2 -2
- data/lib/plurimath/math/function/font_style/script.rb +2 -2
- data/lib/plurimath/math/function/font_style.rb +16 -15
- data/lib/plurimath/math/function/frac.rb +7 -7
- data/lib/plurimath/math/function/hat.rb +8 -8
- data/lib/plurimath/math/function/inf.rb +2 -2
- data/lib/plurimath/math/function/int.rb +8 -8
- data/lib/plurimath/math/function/left.rb +5 -5
- data/lib/plurimath/math/function/lim.rb +3 -3
- data/lib/plurimath/math/function/limits.rb +2 -2
- data/lib/plurimath/math/function/linebreak.rb +2 -2
- data/lib/plurimath/math/function/log.rb +10 -10
- data/lib/plurimath/math/function/longdiv.rb +1 -1
- data/lib/plurimath/math/function/menclose.rb +2 -2
- data/lib/plurimath/math/function/merror.rb +2 -2
- data/lib/plurimath/math/function/mod.rb +1 -1
- data/lib/plurimath/math/function/mpadded.rb +2 -2
- data/lib/plurimath/math/function/ms.rb +2 -2
- data/lib/plurimath/math/function/msgroup.rb +2 -2
- data/lib/plurimath/math/function/multiscript.rb +2 -2
- data/lib/plurimath/math/function/nary.rb +15 -15
- data/lib/plurimath/math/function/none.rb +1 -1
- data/lib/plurimath/math/function/norm.rb +1 -1
- data/lib/plurimath/math/function/obrace.rb +8 -8
- data/lib/plurimath/math/function/oint.rb +6 -6
- data/lib/plurimath/math/function/over.rb +5 -5
- data/lib/plurimath/math/function/overleftrightarrow.rb +7 -7
- data/lib/plurimath/math/function/overset.rb +5 -5
- data/lib/plurimath/math/function/phantom.rb +9 -9
- data/lib/plurimath/math/function/power.rb +5 -5
- data/lib/plurimath/math/function/power_base.rb +5 -5
- data/lib/plurimath/math/function/prod.rb +4 -4
- data/lib/plurimath/math/function/right.rb +5 -5
- data/lib/plurimath/math/function/root.rb +7 -7
- data/lib/plurimath/math/function/rule.rb +2 -2
- data/lib/plurimath/math/function/scarries.rb +1 -1
- data/lib/plurimath/math/function/semantics.rb +4 -4
- data/lib/plurimath/math/function/sqrt.rb +7 -7
- data/lib/plurimath/math/function/stackrel.rb +5 -5
- data/lib/plurimath/math/function/substack.rb +1 -1
- data/lib/plurimath/math/function/sum.rb +4 -4
- data/lib/plurimath/math/function/sup.rb +1 -1
- data/lib/plurimath/math/function/table/array.rb +1 -1
- data/lib/plurimath/math/function/table/bmatrix.rb +2 -2
- data/lib/plurimath/math/function/table/matrix.rb +2 -2
- data/lib/plurimath/math/function/table.rb +29 -29
- data/lib/plurimath/math/function/td.rb +3 -3
- data/lib/plurimath/math/function/ternary_function.rb +13 -13
- data/lib/plurimath/math/function/text.rb +4 -4
- data/lib/plurimath/math/function/tilde.rb +6 -6
- data/lib/plurimath/math/function/tr.rb +4 -4
- data/lib/plurimath/math/function/ubrace.rb +1 -1
- data/lib/plurimath/math/function/ul.rb +9 -9
- data/lib/plurimath/math/function/unary_function.rb +14 -14
- data/lib/plurimath/math/function/underover.rb +1 -1
- data/lib/plurimath/math/function/underset.rb +12 -12
- data/lib/plurimath/math/function/unitsml.rb +1 -1
- data/lib/plurimath/math/function/vec.rb +7 -7
- data/lib/plurimath/math/model_helper.rb +103 -0
- data/lib/plurimath/math/number.rb +2 -2
- data/lib/plurimath/math/symbols/symbol.rb +2 -2
- data/lib/plurimath/math/symbols/tilde.rb +1 -1
- data/lib/plurimath/math.rb +1 -0
- data/lib/plurimath/mathml/constants.rb +29 -155
- data/lib/plurimath/mathml/formula_transformation.rb +2 -5
- data/lib/plurimath/mathml/translator.rb +6 -0
- data/lib/plurimath/mathml/utility.rb +53 -0
- data/lib/plurimath/mathml.rb +1 -0
- data/lib/plurimath/omml/formula_transformation.rb +5 -5
- data/lib/plurimath/omml/translator.rb +8 -5
- data/lib/plurimath/omml/utility.rb +109 -0
- data/lib/plurimath/omml.rb +1 -0
- data/lib/plurimath/unicode_math/transform.rb +5 -1
- data/lib/plurimath/unicode_math/utility.rb +256 -0
- data/lib/plurimath/unicode_math.rb +1 -0
- data/lib/plurimath/utility/intent_encoding.rb +4 -4
- data/lib/plurimath/utility.rb +6 -815
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath/xml_engine/oga/dumper.rb +8 -1
- data/lib/plurimath/xml_engine/ox_engine.rb +4 -1
- data/lib/plurimath/xml_helper.rb +47 -0
- data/lib/plurimath.rb +1 -0
- data/plurimath.gemspec +2 -2
- metadata +16 -8
|
@@ -9,7 +9,7 @@ module Plurimath
|
|
|
9
9
|
def initialize(parameter_one = nil, parameter_two = nil)
|
|
10
10
|
@parameter_one = parameter_one
|
|
11
11
|
@parameter_two = parameter_two
|
|
12
|
-
|
|
12
|
+
ModelHelper.validate_left_right(variables.map { |var| get(var) })
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def to_asciimath(options:)
|
|
@@ -25,8 +25,8 @@ module Plurimath
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def to_mathml_without_math_tag(intent, options:)
|
|
28
|
-
mrow_tag =
|
|
29
|
-
mo_tag =
|
|
28
|
+
mrow_tag = XmlHelper.ox_element("mrow")
|
|
29
|
+
mo_tag = XmlHelper.ox_element("mo") << invert_unicode_symbols.to_s
|
|
30
30
|
if parameter_one
|
|
31
31
|
first_value = parameter_one&.to_mathml_without_math_tag(intent,
|
|
32
32
|
options: options)
|
|
@@ -35,7 +35,7 @@ module Plurimath
|
|
|
35
35
|
second_value = parameter_two&.to_mathml_without_math_tag(intent,
|
|
36
36
|
options: options)
|
|
37
37
|
end
|
|
38
|
-
|
|
38
|
+
XmlHelper.update_nodes(
|
|
39
39
|
mrow_tag,
|
|
40
40
|
[
|
|
41
41
|
first_value,
|
|
@@ -64,14 +64,14 @@ module Plurimath
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
def to_omml_without_math_tag(display_style, options:)
|
|
67
|
-
r_tag =
|
|
67
|
+
r_tag = XmlHelper.ox_element("r", namespace: "m")
|
|
68
68
|
if parameter_one
|
|
69
|
-
|
|
69
|
+
XmlHelper.update_nodes(r_tag,
|
|
70
70
|
[parameter_one.insert_t_tag(display_style,
|
|
71
71
|
options: options)])
|
|
72
72
|
end
|
|
73
73
|
if parameter_two
|
|
74
|
-
|
|
74
|
+
XmlHelper.update_nodes(r_tag,
|
|
75
75
|
[parameter_two.insert_t_tag(display_style,
|
|
76
76
|
options: options)])
|
|
77
77
|
end
|
|
@@ -5,13 +5,13 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Cancel < UnaryFunction
|
|
7
7
|
def to_mathml_without_math_tag(intent, options:)
|
|
8
|
-
cancel_tag =
|
|
8
|
+
cancel_tag = XmlHelper.ox_element(
|
|
9
9
|
"menclose",
|
|
10
10
|
attributes: { notation: "updiagonalstrike" },
|
|
11
11
|
)
|
|
12
12
|
first_value = parameter_one&.to_mathml_without_math_tag(intent,
|
|
13
13
|
options: options)
|
|
14
|
-
|
|
14
|
+
XmlHelper.update_nodes(cancel_tag, [first_value])
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def to_omml_without_math_tag(display_style, options:)
|
|
@@ -17,7 +17,7 @@ module Plurimath
|
|
|
17
17
|
paren_node("⌈"))
|
|
18
18
|
end
|
|
19
19
|
first_value = first_value << paren_node("⌉") unless close_paren
|
|
20
|
-
|
|
20
|
+
XmlHelper.update_nodes(ox_element("mrow"), first_value)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def to_omml_without_math_tag(display_style, options:)
|
|
@@ -12,9 +12,9 @@ module Plurimath
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def to_mathml_without_math_tag(intent, options:)
|
|
15
|
-
second_value =
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
second_value = XmlHelper.ox_element("mo") << ".."
|
|
16
|
+
XmlHelper.update_nodes(
|
|
17
|
+
XmlHelper.ox_element("mover", attributes: { accent: "true" }),
|
|
18
18
|
mathml_value(intent, options: options) << second_value,
|
|
19
19
|
)
|
|
20
20
|
end
|
|
@@ -12,18 +12,18 @@ module Plurimath
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def to_mathml_without_math_tag(intent, options:)
|
|
15
|
-
dot_tag =
|
|
15
|
+
dot_tag = XmlHelper.ox_element("mo") << "."
|
|
16
16
|
return dot_tag unless parameter_one
|
|
17
17
|
|
|
18
18
|
first_value = parameter_one&.to_mathml_without_math_tag(intent,
|
|
19
19
|
options: options)
|
|
20
|
-
dot_tag = (
|
|
21
|
-
over_tag =
|
|
20
|
+
dot_tag = (XmlHelper.ox_element("mo") << ".")
|
|
21
|
+
over_tag = XmlHelper.ox_element("mover")
|
|
22
22
|
if attributes && attributes[:accent]
|
|
23
23
|
over_tag[:accent] =
|
|
24
24
|
attributes[:accent]
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
XmlHelper.update_nodes(
|
|
27
27
|
over_tag,
|
|
28
28
|
[
|
|
29
29
|
first_value,
|
|
@@ -60,14 +60,14 @@ module Plurimath
|
|
|
60
60
|
protected
|
|
61
61
|
|
|
62
62
|
def acc_tag(display_style, options:)
|
|
63
|
-
acc_tag =
|
|
64
|
-
acc_pr_tag =
|
|
65
|
-
acc_pr_tag <<
|
|
63
|
+
acc_tag = XmlHelper.ox_element("acc", namespace: "m")
|
|
64
|
+
acc_pr_tag = XmlHelper.ox_element("accPr", namespace: "m")
|
|
65
|
+
acc_pr_tag << XmlHelper.ox_element(
|
|
66
66
|
"chr",
|
|
67
67
|
namespace: "m",
|
|
68
68
|
attributes: { "m:val": "." },
|
|
69
69
|
)
|
|
70
|
-
|
|
70
|
+
XmlHelper.update_nodes(
|
|
71
71
|
acc_tag,
|
|
72
72
|
[
|
|
73
73
|
acc_pr_tag,
|
|
@@ -41,7 +41,7 @@ module Plurimath
|
|
|
41
41
|
intent, options: options) || "")
|
|
42
42
|
mrow_value = Array(mathml_value(intent, options: options))&.insert(0,
|
|
43
43
|
first_value)&.<< third_value
|
|
44
|
-
fenced =
|
|
44
|
+
fenced = XmlHelper.update_nodes(ox_element("mrow"), mrow_value)
|
|
45
45
|
intentify(
|
|
46
46
|
fenced,
|
|
47
47
|
intent,
|
|
@@ -81,12 +81,12 @@ module Plurimath
|
|
|
81
81
|
|
|
82
82
|
def to_omml_without_math_tag(display_style, options:)
|
|
83
83
|
attrs = { "m:val": (options ? options[:separators] : "") }
|
|
84
|
-
d =
|
|
85
|
-
dpr =
|
|
84
|
+
d = XmlHelper.ox_element("d", namespace: "m")
|
|
85
|
+
dpr = XmlHelper.ox_element("dPr", namespace: "m")
|
|
86
86
|
open_paren(dpr, options: options)
|
|
87
|
-
dpr <<
|
|
87
|
+
dpr << XmlHelper.ox_element("sepChr", namespace: "m", attributes: attrs)
|
|
88
88
|
close_paren(dpr, options: options)
|
|
89
|
-
|
|
89
|
+
XmlHelper.update_nodes(
|
|
90
90
|
d,
|
|
91
91
|
[
|
|
92
92
|
dpr,
|
|
@@ -223,7 +223,7 @@ options:)
|
|
|
223
223
|
return dpr if first_value.nil?
|
|
224
224
|
|
|
225
225
|
attributes = { "m:val": Utility.html_entity_to_unicode(first_value) }
|
|
226
|
-
dpr <<
|
|
226
|
+
dpr << XmlHelper.ox_element(
|
|
227
227
|
"begChr",
|
|
228
228
|
namespace: "m",
|
|
229
229
|
attributes: attributes,
|
|
@@ -236,7 +236,7 @@ options:)
|
|
|
236
236
|
return dpr if third_value.nil?
|
|
237
237
|
|
|
238
238
|
attributes = { "m:val": Utility.html_entity_to_unicode(third_value) }
|
|
239
|
-
dpr <<
|
|
239
|
+
dpr << XmlHelper.ox_element(
|
|
240
240
|
"endChr",
|
|
241
241
|
namespace: "m",
|
|
242
242
|
attributes: attributes,
|
|
@@ -409,7 +409,7 @@ options:)
|
|
|
409
409
|
object&.to_mathml_without_math_tag(intent, options: options)
|
|
410
410
|
end
|
|
411
411
|
if intent
|
|
412
|
-
mrow =
|
|
412
|
+
mrow = XmlHelper.update_nodes(ox_element("mrow"), nodes)
|
|
413
413
|
update_partial_derivative(nodes) unless mrow.locate("*/mfrac/@intent").empty?
|
|
414
414
|
end
|
|
415
415
|
nodes
|
|
@@ -19,7 +19,7 @@ module Plurimath
|
|
|
19
19
|
ox_element("mo") << "⌊")
|
|
20
20
|
end
|
|
21
21
|
value_array << (ox_element("mo") << "⌋") unless close_paren
|
|
22
|
-
|
|
22
|
+
XmlHelper.update_nodes(ox_element("mrow"), value_array)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def to_omml_without_math_tag(display_style, options:)
|
|
@@ -33,8 +33,8 @@ module Plurimath
|
|
|
33
33
|
def to_mathml_without_math_tag(intent, options:)
|
|
34
34
|
first_value = parameter_one&.to_mathml_without_math_tag(intent,
|
|
35
35
|
options: options)
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
XmlHelper.update_nodes(
|
|
37
|
+
XmlHelper.ox_element(
|
|
38
38
|
"mstyle",
|
|
39
39
|
attributes: { mathvariant: font_family(mathml: true) },
|
|
40
40
|
),
|
|
@@ -63,7 +63,8 @@ module Plurimath
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def extract_class_name_from_text
|
|
66
|
-
parameter_one.parameter_one if parameter_one.is_a?(Text)
|
|
66
|
+
return parameter_one.parameter_one if parameter_one.is_a?(Text)
|
|
67
|
+
|
|
67
68
|
parameter_one.class_name
|
|
68
69
|
end
|
|
69
70
|
|
|
@@ -80,7 +81,7 @@ module Plurimath
|
|
|
80
81
|
|
|
81
82
|
if children.all? { |node| node.is_a?(String) || t_tag_node?(node) }
|
|
82
83
|
r_tag = empty_font_style_r_tag(sty, scr)
|
|
83
|
-
|
|
84
|
+
XmlHelper.update_nodes(r_tag, children)
|
|
84
85
|
return [r_tag]
|
|
85
86
|
end
|
|
86
87
|
|
|
@@ -118,15 +119,15 @@ module Plurimath
|
|
|
118
119
|
end
|
|
119
120
|
|
|
120
121
|
def empty_font_style_r_tag(sty, scr)
|
|
121
|
-
r_tag =
|
|
122
|
-
rpr_tag =
|
|
122
|
+
r_tag = XmlHelper.ox_element("r", namespace: "m")
|
|
123
|
+
rpr_tag = XmlHelper.ox_element("rPr", namespace: "m")
|
|
123
124
|
if scr
|
|
124
|
-
rpr_tag <<
|
|
125
|
-
|
|
125
|
+
rpr_tag << XmlHelper.ox_element("scr", namespace: "m",
|
|
126
|
+
attributes: { "m:val": scr })
|
|
126
127
|
end
|
|
127
128
|
if sty
|
|
128
|
-
rpr_tag <<
|
|
129
|
-
|
|
129
|
+
rpr_tag << XmlHelper.ox_element("sty", namespace: "m",
|
|
130
|
+
attributes: { "m:val": sty })
|
|
130
131
|
end
|
|
131
132
|
r_tag << rpr_tag
|
|
132
133
|
r_tag
|
|
@@ -137,14 +138,14 @@ module Plurimath
|
|
|
137
138
|
n.respond_to?(:name) && n.name == "m:rPr"
|
|
138
139
|
end
|
|
139
140
|
|
|
140
|
-
rpr_tag =
|
|
141
|
+
rpr_tag = XmlHelper.ox_element("rPr", namespace: "m")
|
|
141
142
|
if scr
|
|
142
|
-
rpr_tag <<
|
|
143
|
-
|
|
143
|
+
rpr_tag << XmlHelper.ox_element("scr", namespace: "m",
|
|
144
|
+
attributes: { "m:val": scr })
|
|
144
145
|
end
|
|
145
146
|
if sty
|
|
146
|
-
rpr_tag <<
|
|
147
|
-
|
|
147
|
+
rpr_tag << XmlHelper.ox_element("sty", namespace: "m",
|
|
148
|
+
attributes: { "m:val": sty })
|
|
148
149
|
end
|
|
149
150
|
r_node.insert_in_nodes(0, rpr_tag)
|
|
150
151
|
end
|
|
@@ -42,7 +42,7 @@ module Plurimath
|
|
|
42
42
|
opt == :choose
|
|
43
43
|
end)
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
XmlHelper.update_nodes(frac_tag, mathml_value)
|
|
46
46
|
if intent
|
|
47
47
|
update_derivative(frac_tag, mathml_value[0],
|
|
48
48
|
mathml_value[1])
|
|
@@ -57,8 +57,8 @@ module Plurimath
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def to_omml_without_math_tag(display_style, options:)
|
|
60
|
-
f_element =
|
|
61
|
-
|
|
60
|
+
f_element = XmlHelper.ox_element("f", namespace: "m")
|
|
61
|
+
XmlHelper.update_nodes(
|
|
62
62
|
f_element,
|
|
63
63
|
[
|
|
64
64
|
fpr_element,
|
|
@@ -137,13 +137,13 @@ module Plurimath
|
|
|
137
137
|
protected
|
|
138
138
|
|
|
139
139
|
def fpr_element
|
|
140
|
-
fpr_element =
|
|
140
|
+
fpr_element = XmlHelper.ox_element("fPr", namespace: "m")
|
|
141
141
|
if options
|
|
142
142
|
attributes = { "m:val": attr_value }
|
|
143
|
-
fpr_element <<
|
|
144
|
-
|
|
143
|
+
fpr_element << XmlHelper.ox_element("type", namespace: "m",
|
|
144
|
+
attributes: attributes)
|
|
145
145
|
end
|
|
146
|
-
fpr_element <<
|
|
146
|
+
fpr_element << XmlHelper.pr_element("ctrl", true, namespace: "m")
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
def attr_value
|
|
@@ -22,12 +22,12 @@ module Plurimath
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def to_mathml_without_math_tag(intent, options:)
|
|
25
|
-
mo_tag = (
|
|
25
|
+
mo_tag = (XmlHelper.ox_element("mo") << "^")
|
|
26
26
|
return mo_tag unless parameter_one
|
|
27
27
|
|
|
28
|
-
mover_tag =
|
|
28
|
+
mover_tag = XmlHelper.ox_element("mover")
|
|
29
29
|
mover_tag.set_attr(attributes) if attributes && !attributes.empty?
|
|
30
|
-
|
|
30
|
+
XmlHelper.update_nodes(
|
|
31
31
|
mover_tag,
|
|
32
32
|
[
|
|
33
33
|
parameter_one&.to_mathml_without_math_tag(intent,
|
|
@@ -75,11 +75,11 @@ module Plurimath
|
|
|
75
75
|
|
|
76
76
|
def accent_tag(display_style, options:)
|
|
77
77
|
symbol = "̂" unless hide_function_name
|
|
78
|
-
acc_tag =
|
|
79
|
-
acc_pr_tag =
|
|
80
|
-
acc_pr_tag <<
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
acc_tag = XmlHelper.ox_element("acc", namespace: "m")
|
|
79
|
+
acc_pr_tag = XmlHelper.ox_element("accPr", namespace: "m")
|
|
80
|
+
acc_pr_tag << XmlHelper.ox_element("chr", namespace: "m",
|
|
81
|
+
attributes: { "m:val": symbol })
|
|
82
|
+
XmlHelper.update_nodes(
|
|
83
83
|
acc_tag,
|
|
84
84
|
[
|
|
85
85
|
acc_pr_tag,
|
|
@@ -17,7 +17,7 @@ module Plurimath
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def to_mathml_without_math_tag(intent, options:)
|
|
20
|
-
first_value =
|
|
20
|
+
first_value = XmlHelper.ox_element("mo") << class_name
|
|
21
21
|
return first_value unless any_value_exist?
|
|
22
22
|
|
|
23
23
|
tag_name = if parameter_two && parameter_one
|
|
@@ -26,7 +26,7 @@ module Plurimath
|
|
|
26
26
|
parameter_one ? "under" : "over"
|
|
27
27
|
end
|
|
28
28
|
inf_tag = ox_element("m#{tag_name}")
|
|
29
|
-
|
|
29
|
+
XmlHelper.update_nodes(
|
|
30
30
|
inf_tag,
|
|
31
31
|
[
|
|
32
32
|
first_value,
|
|
@@ -44,11 +44,11 @@ module Plurimath
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def to_mathml_without_math_tag(intent, options:)
|
|
47
|
-
base_element = (
|
|
47
|
+
base_element = (XmlHelper.ox_element("mo") << invert_unicode_symbols.to_s)
|
|
48
48
|
return base_element unless any_value_exist?
|
|
49
49
|
|
|
50
|
-
msubsup_tag =
|
|
51
|
-
|
|
50
|
+
msubsup_tag = XmlHelper.ox_element("msubsup")
|
|
51
|
+
XmlHelper.update_nodes(
|
|
52
52
|
msubsup_tag,
|
|
53
53
|
[
|
|
54
54
|
base_element,
|
|
@@ -60,7 +60,7 @@ module Plurimath
|
|
|
60
60
|
return msubsup_tag if parameter_three.nil?
|
|
61
61
|
|
|
62
62
|
mrow = ox_element("mrow")
|
|
63
|
-
|
|
63
|
+
XmlHelper.update_nodes(
|
|
64
64
|
mrow,
|
|
65
65
|
[
|
|
66
66
|
msubsup_tag,
|
|
@@ -76,13 +76,13 @@ module Plurimath
|
|
|
76
76
|
|
|
77
77
|
def to_omml_without_math_tag(display_style, options:)
|
|
78
78
|
if any_value_exist?
|
|
79
|
-
nary =
|
|
80
|
-
|
|
79
|
+
nary = XmlHelper.ox_element("nary", namespace: "m")
|
|
80
|
+
XmlHelper.update_nodes(nary,
|
|
81
81
|
nary_array(display_style, options: options))
|
|
82
82
|
[nary]
|
|
83
83
|
else
|
|
84
|
-
r_tag =
|
|
85
|
-
t_tag =
|
|
84
|
+
r_tag = XmlHelper.ox_element("r", namespace: "m")
|
|
85
|
+
t_tag = XmlHelper.ox_element("t", namespace: "m")
|
|
86
86
|
r_tag << (t_tag << "∫")
|
|
87
87
|
[r_tag]
|
|
88
88
|
end
|
|
@@ -9,15 +9,15 @@ module Plurimath
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def to_mathml_without_math_tag(_intent, **)
|
|
12
|
-
mo =
|
|
12
|
+
mo = XmlHelper.ox_element("mo")
|
|
13
13
|
mo << left_paren if parameter_one
|
|
14
14
|
mo
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def to_omml_without_math_tag(_, **)
|
|
18
|
-
mr =
|
|
18
|
+
mr = XmlHelper.ox_element("m:r")
|
|
19
19
|
if parameter_one
|
|
20
|
-
mt =
|
|
20
|
+
mt = XmlHelper.ox_element("m:t")
|
|
21
21
|
mr << (mt << parameter_one)
|
|
22
22
|
end
|
|
23
23
|
[mr]
|
|
@@ -48,12 +48,12 @@ module Plurimath
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def to_mathml_math_zone(spacing = "", _, _, **)
|
|
51
|
-
mo_tag = (
|
|
51
|
+
mo_tag = (XmlHelper.ox_element("mo") << left_paren)
|
|
52
52
|
"#{spacing}\"#{dump_ox_nodes(mo_tag).gsub(/\s+/, '')}\" left\n"
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def to_omml_math_zone(spacing = "", _, _, display_style:, **)
|
|
56
|
-
t_tag = (
|
|
56
|
+
t_tag = (XmlHelper.ox_element("t", namespace: "m") << left_paren)
|
|
57
57
|
"#{spacing}\"#{dump_ox_nodes(t_tag).gsub(/\s+/, '')}\" left\n"
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -35,7 +35,7 @@ module Plurimath
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def to_mathml_without_math_tag(intent, options:)
|
|
38
|
-
first_value =
|
|
38
|
+
first_value = XmlHelper.ox_element("mo") << "lim"
|
|
39
39
|
return first_value unless any_value_exist?
|
|
40
40
|
|
|
41
41
|
tag_name = if parameter_two && parameter_one
|
|
@@ -43,8 +43,8 @@ module Plurimath
|
|
|
43
43
|
else
|
|
44
44
|
parameter_one ? "under" : "over"
|
|
45
45
|
end
|
|
46
|
-
lim_tag =
|
|
47
|
-
|
|
46
|
+
lim_tag = XmlHelper.ox_element("m#{tag_name}")
|
|
47
|
+
XmlHelper.update_nodes(
|
|
48
48
|
lim_tag,
|
|
49
49
|
[
|
|
50
50
|
first_value,
|
|
@@ -12,13 +12,13 @@ module Plurimath
|
|
|
12
12
|
}.freeze
|
|
13
13
|
|
|
14
14
|
def to_mathml_without_math_tag(intent, options:)
|
|
15
|
-
underover =
|
|
15
|
+
underover = XmlHelper.ox_element("munderover")
|
|
16
16
|
value_array = [
|
|
17
17
|
validate_mathml_fields(parameter_one, intent, options: options),
|
|
18
18
|
validate_mathml_fields(parameter_two, intent, options: options),
|
|
19
19
|
validate_mathml_fields(parameter_three, intent, options: options),
|
|
20
20
|
]
|
|
21
|
-
|
|
21
|
+
XmlHelper.update_nodes(underover, value_array)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def to_latex(options:)
|
|
@@ -9,7 +9,7 @@ module Plurimath
|
|
|
9
9
|
def initialize(parameter_one = nil, attributes = {})
|
|
10
10
|
@parameter_one = parameter_one
|
|
11
11
|
@attributes = attributes
|
|
12
|
-
|
|
12
|
+
ModelHelper.validate_left_right([parameter_one])
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def ==(object)
|
|
@@ -44,7 +44,7 @@ module Plurimath
|
|
|
44
44
|
|
|
45
45
|
def to_mathml_without_math_tag(intent, options:)
|
|
46
46
|
unless parameter_one
|
|
47
|
-
return
|
|
47
|
+
return XmlHelper.ox_element("mo",
|
|
48
48
|
attributes: { linebreak: "newline" })
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -62,10 +62,10 @@ module Plurimath
|
|
|
62
62
|
def to_omml_without_math_tag(display_style, options:)
|
|
63
63
|
return r_element("log", rpr_tag: false) unless any_value_exist?
|
|
64
64
|
|
|
65
|
-
ssubsup =
|
|
66
|
-
ssubsuppr =
|
|
67
|
-
ssubsuppr <<
|
|
68
|
-
|
|
65
|
+
ssubsup = XmlHelper.ox_element("sSubSup", namespace: "m")
|
|
66
|
+
ssubsuppr = XmlHelper.ox_element("sSubSupPr", namespace: "m")
|
|
67
|
+
ssubsuppr << XmlHelper.pr_element("ctrl", true, namespace: "m")
|
|
68
|
+
XmlHelper.update_nodes(
|
|
69
69
|
ssubsup,
|
|
70
70
|
[
|
|
71
71
|
ssubsuppr,
|
|
@@ -94,7 +94,7 @@ module Plurimath
|
|
|
94
94
|
validate_mathml_fields(parameter_one, intent, options: options),
|
|
95
95
|
validate_mathml_fields(parameter_two, intent, options: options),
|
|
96
96
|
]
|
|
97
|
-
|
|
97
|
+
XmlHelper.update_nodes(ox_element("m#{tag_name}"), new_arr)
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
def to_unicodemath(options:)
|
|
@@ -117,18 +117,18 @@ module Plurimath
|
|
|
117
117
|
protected
|
|
118
118
|
|
|
119
119
|
def e_parameter
|
|
120
|
-
e_tag =
|
|
120
|
+
e_tag = XmlHelper.ox_element("e", namespace: "m")
|
|
121
121
|
return e_tag if hide_function_name
|
|
122
122
|
|
|
123
123
|
e_tag << rpr_tag
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
def rpr_tag
|
|
127
|
-
rpr_tag = (
|
|
127
|
+
rpr_tag = (XmlHelper.ox_element("rPr",
|
|
128
128
|
namespace: "m") << msty_tag_with_attrs)
|
|
129
|
-
r_tag =
|
|
130
|
-
t_tag = (
|
|
131
|
-
|
|
129
|
+
r_tag = XmlHelper.ox_element("r", namespace: "m")
|
|
130
|
+
t_tag = (XmlHelper.ox_element("t", namespace: "m") << "log")
|
|
131
|
+
XmlHelper.update_nodes(r_tag, [rpr_tag, t_tag])
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
def sup_value(options:)
|