plurimath 0.11.6 → 0.11.8
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 +5 -0
- metadata +24 -2
|
@@ -47,7 +47,7 @@ module Plurimath
|
|
|
47
47
|
|
|
48
48
|
def to_omml_without_math_tag(display_style, options:)
|
|
49
49
|
borderbox = ox_element("borderBox", namespace: "m")
|
|
50
|
-
|
|
50
|
+
XmlHelper.update_nodes(
|
|
51
51
|
borderbox,
|
|
52
52
|
[
|
|
53
53
|
borderboxpr,
|
|
@@ -63,7 +63,7 @@ module Plurimath
|
|
|
63
63
|
"#{unicode_symbol}#{unicodemath_parens(parameter_two,
|
|
64
64
|
options: options)}"
|
|
65
65
|
elsif masked_class?
|
|
66
|
-
first_value =
|
|
66
|
+
first_value = ModelHelper.notations_to_mask(parameter_one) if parameter_one
|
|
67
67
|
second_value = parameter_two&.to_unicodemath(options: options) if parameter_two
|
|
68
68
|
"▭(#{first_value}&#{second_value})"
|
|
69
69
|
end
|
|
@@ -9,8 +9,8 @@ module Plurimath
|
|
|
9
9
|
def to_latex(**); end
|
|
10
10
|
|
|
11
11
|
def to_mathml_without_math_tag(intent, options:)
|
|
12
|
-
merror =
|
|
13
|
-
|
|
12
|
+
merror = XmlHelper.ox_element("merror")
|
|
13
|
+
XmlHelper.update_nodes(merror, mathml_value(intent, options: options))
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def to_omml_without_math_tag(_, **); end
|
|
@@ -44,7 +44,7 @@ module Plurimath
|
|
|
44
44
|
value_array << parameter_two&.to_mathml_without_math_tag(intent,
|
|
45
45
|
options: options)
|
|
46
46
|
end
|
|
47
|
-
|
|
47
|
+
XmlHelper.update_nodes(ox_element("mrow"), value_array)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def to_latex(options:)
|
|
@@ -31,7 +31,7 @@ module Plurimath
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def to_mathml_without_math_tag(intent, options:)
|
|
34
|
-
|
|
34
|
+
XmlHelper.update_nodes(
|
|
35
35
|
ox_element(class_name, attributes: self.options),
|
|
36
36
|
Array(mathml_value(intent, options: options)),
|
|
37
37
|
)
|
|
@@ -40,7 +40,7 @@ module Plurimath
|
|
|
40
40
|
def to_omml_without_math_tag(display_style, options:)
|
|
41
41
|
phant = ox_element("phant", namespace: "m")
|
|
42
42
|
phantpr = ox_element("phantPr", namespace: "m")
|
|
43
|
-
|
|
43
|
+
XmlHelper.update_nodes(phantpr, phant_pr)
|
|
44
44
|
phant << phantpr unless phantpr.nodes.empty?
|
|
45
45
|
|
|
46
46
|
phant << omml_parameter(parameter_one, display_style, tag_name: "e",
|
|
@@ -5,7 +5,7 @@ module Plurimath
|
|
|
5
5
|
module Function
|
|
6
6
|
class Ms < UnaryFunction
|
|
7
7
|
def to_mathml_without_math_tag(_intent, **)
|
|
8
|
-
|
|
8
|
+
XmlHelper.ox_element("ms") << parameter_one
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def to_asciimath(**)
|
|
@@ -18,7 +18,7 @@ module Plurimath
|
|
|
18
18
|
|
|
19
19
|
def to_omml_without_math_tag(_display_style, **)
|
|
20
20
|
[
|
|
21
|
-
|
|
21
|
+
XmlHelper.ox_element("t", namespace: "m") << "“#{parameter_one}”",
|
|
22
22
|
]
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -15,8 +15,8 @@ module Plurimath
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def to_mathml_without_math_tag(intent, options:)
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
XmlHelper.update_nodes(
|
|
19
|
+
XmlHelper.ox_element("msgroup"),
|
|
20
20
|
parameter_one.map do |object|
|
|
21
21
|
object&.to_mathml_without_math_tag(intent, options: options)
|
|
22
22
|
end,
|
|
@@ -43,7 +43,7 @@ module Plurimath
|
|
|
43
43
|
|
|
44
44
|
def to_mathml_without_math_tag(intent, options:)
|
|
45
45
|
mprescript = ox_element("mprescripts") if parameter_two || parameter_three
|
|
46
|
-
|
|
46
|
+
XmlHelper.update_nodes(
|
|
47
47
|
ox_element("mmultiscripts"),
|
|
48
48
|
[
|
|
49
49
|
parameter_one&.mmultiscript(intent, options: options),
|
|
@@ -54,7 +54,7 @@ module Plurimath
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def to_omml_without_math_tag(display_style, options:)
|
|
57
|
-
|
|
57
|
+
XmlHelper.update_nodes(
|
|
58
58
|
ox_element("sPre", namespace: "m"),
|
|
59
59
|
[
|
|
60
60
|
omml_parameter(parameter_one, display_style, tag_name: "e",
|
|
@@ -17,8 +17,8 @@ module Plurimath
|
|
|
17
17
|
@parameter_three = parameter_three
|
|
18
18
|
@parameter_four = parameter_four
|
|
19
19
|
@options = options
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
ModelHelper.validate_left_right([parameter_one, parameter_two,
|
|
21
|
+
parameter_three, parameter_four])
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def ==(object)
|
|
@@ -52,12 +52,12 @@ module Plurimath
|
|
|
52
52
|
validate_mathml_fields(parameter_two, intent, options: options),
|
|
53
53
|
validate_mathml_fields(parameter_three, intent, options: options),
|
|
54
54
|
]
|
|
55
|
-
subsup_tag =
|
|
55
|
+
subsup_tag = XmlHelper.update_nodes(ox_element(tag_name), new_arr)
|
|
56
56
|
masked_tag(subsup_tag) if self.options[:mask]
|
|
57
57
|
return subsup_tag unless parameter_four
|
|
58
58
|
|
|
59
59
|
intentify(
|
|
60
|
-
|
|
60
|
+
XmlHelper.update_nodes(
|
|
61
61
|
ox_element("mrow"),
|
|
62
62
|
[
|
|
63
63
|
subsup_tag,
|
|
@@ -74,8 +74,8 @@ module Plurimath
|
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
def to_omml_without_math_tag(display_style, options:)
|
|
77
|
-
nary_element =
|
|
78
|
-
|
|
77
|
+
nary_element = XmlHelper.ox_element("nary", namespace: "m")
|
|
78
|
+
XmlHelper.update_nodes(nary_element,
|
|
79
79
|
omml_nary_tag(display_style, options: options))
|
|
80
80
|
Array(nary_element)
|
|
81
81
|
end
|
|
@@ -140,7 +140,7 @@ module Plurimath
|
|
|
140
140
|
next unless sym_instance.is_nary_symbol?
|
|
141
141
|
|
|
142
142
|
intent_name = sym_instance.nary_intent_name
|
|
143
|
-
next
|
|
143
|
+
next if intent_name.nil?
|
|
144
144
|
|
|
145
145
|
hash[intent_name.gsub(/\s|-/, "_").to_sym] = intent_name
|
|
146
146
|
end
|
|
@@ -155,12 +155,12 @@ module Plurimath
|
|
|
155
155
|
def chr_value(narypr, options:)
|
|
156
156
|
first_value = Utility.html_entity_to_unicode(parameter_one&.nary_attr_value(options: options))
|
|
157
157
|
unless first_value == "∫"
|
|
158
|
-
narypr <<
|
|
159
|
-
|
|
158
|
+
narypr << XmlHelper.ox_element("chr", namespace: "m",
|
|
159
|
+
attributes: { "m:val": first_value })
|
|
160
160
|
end
|
|
161
161
|
|
|
162
|
-
narypr <<
|
|
163
|
-
|
|
162
|
+
narypr << XmlHelper.ox_element("limLoc", namespace: "m",
|
|
163
|
+
attributes: { "m:val": (self.options[:type] || "subSup").to_s })
|
|
164
164
|
hide_tags(narypr, parameter_two, "sub")
|
|
165
165
|
hide_tags(narypr, parameter_three, "sup")
|
|
166
166
|
narypr
|
|
@@ -169,15 +169,15 @@ module Plurimath
|
|
|
169
169
|
def hide_tags(nar, field, tag_prefix)
|
|
170
170
|
return nar unless field.nil?
|
|
171
171
|
|
|
172
|
-
nar <<
|
|
173
|
-
|
|
172
|
+
nar << XmlHelper.ox_element("#{tag_prefix}Hide", namespace: "m",
|
|
173
|
+
attributes: { "m:val": "1" })
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
def omml_nary_tag(display_style, options:)
|
|
177
|
-
narypr =
|
|
177
|
+
narypr = XmlHelper.ox_element("naryPr", namespace: "m")
|
|
178
178
|
chr_value(narypr, options: options)
|
|
179
179
|
[
|
|
180
|
-
(narypr <<
|
|
180
|
+
(narypr << XmlHelper.pr_element("ctrl", true, namespace: "m")),
|
|
181
181
|
omml_parameter(parameter_two, display_style, tag_name: "sub",
|
|
182
182
|
options: options),
|
|
183
183
|
omml_parameter(parameter_three, display_style, tag_name: "sup",
|
|
@@ -20,7 +20,7 @@ module Plurimath
|
|
|
20
20
|
norm = ox_element("mo") << "∥"
|
|
21
21
|
first_value.insert(0, norm) unless open_paren
|
|
22
22
|
first_value = first_value << norm unless close_paren
|
|
23
|
-
|
|
23
|
+
XmlHelper.update_nodes(ox_element("mrow"), first_value)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def to_unicodemath(options:)
|
|
@@ -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
|
-
over_tag =
|
|
28
|
+
over_tag = XmlHelper.ox_element("mover")
|
|
29
29
|
over_tag.set_attr(attributes) if attributes && !attributes.empty?
|
|
30
|
-
|
|
30
|
+
XmlHelper.update_nodes(
|
|
31
31
|
over_tag,
|
|
32
32
|
[
|
|
33
33
|
parameter_one.to_mathml_without_math_tag(intent,
|
|
@@ -65,11 +65,11 @@ module Plurimath
|
|
|
65
65
|
protected
|
|
66
66
|
|
|
67
67
|
def acc_tag(display_style, options:)
|
|
68
|
-
acc_tag =
|
|
69
|
-
acc_pr_tag =
|
|
70
|
-
acc_pr_tag <<
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
acc_tag = XmlHelper.ox_element("acc", namespace: "m")
|
|
69
|
+
acc_pr_tag = XmlHelper.ox_element("accPr", namespace: "m")
|
|
70
|
+
acc_pr_tag << XmlHelper.ox_element("chr", namespace: "m",
|
|
71
|
+
attributes: { "m:val": "⏞" })
|
|
72
|
+
XmlHelper.update_nodes(
|
|
73
73
|
acc_tag,
|
|
74
74
|
[
|
|
75
75
|
acc_pr_tag,
|
|
@@ -59,7 +59,7 @@ module Plurimath
|
|
|
59
59
|
parameter_one ? "sub" : "sup"
|
|
60
60
|
end
|
|
61
61
|
oint_tag = ox_element("m#{tag_name}")
|
|
62
|
-
|
|
62
|
+
XmlHelper.update_nodes(
|
|
63
63
|
oint_tag,
|
|
64
64
|
[
|
|
65
65
|
mo_tag,
|
|
@@ -72,7 +72,7 @@ module Plurimath
|
|
|
72
72
|
return ternary_intentify(oint_tag, intent) unless parameter_three
|
|
73
73
|
|
|
74
74
|
ternary_intentify(
|
|
75
|
-
|
|
75
|
+
XmlHelper.update_nodes(
|
|
76
76
|
ox_element("mrow"),
|
|
77
77
|
[
|
|
78
78
|
oint_tag,
|
|
@@ -88,8 +88,8 @@ module Plurimath
|
|
|
88
88
|
|
|
89
89
|
def to_omml_without_math_tag(display_style, options:)
|
|
90
90
|
if any_value_exist?
|
|
91
|
-
nary =
|
|
92
|
-
|
|
91
|
+
nary = XmlHelper.ox_element("nary", namespace: "m")
|
|
92
|
+
XmlHelper.update_nodes(
|
|
93
93
|
nary,
|
|
94
94
|
[
|
|
95
95
|
narypr((hide_function_name ? "" : "∮"),
|
|
@@ -104,8 +104,8 @@ module Plurimath
|
|
|
104
104
|
)
|
|
105
105
|
[nary]
|
|
106
106
|
else
|
|
107
|
-
r_tag =
|
|
108
|
-
t_tag =
|
|
107
|
+
r_tag = XmlHelper.ox_element("r", namespace: "m")
|
|
108
|
+
t_tag = XmlHelper.ox_element("t", namespace: "m")
|
|
109
109
|
r_tag << (t_tag << "∮")
|
|
110
110
|
[r_tag]
|
|
111
111
|
end
|
|
@@ -22,7 +22,7 @@ module Plurimath
|
|
|
22
22
|
parameter_one&.to_mathml_without_math_tag(intent, options: options),
|
|
23
23
|
parameter_two&.to_mathml_without_math_tag(intent, options: options),
|
|
24
24
|
]
|
|
25
|
-
|
|
25
|
+
XmlHelper.update_nodes(ox_element(tag_name), mathml_value)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def to_latex(options:)
|
|
@@ -32,12 +32,12 @@ module Plurimath
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def to_omml_without_math_tag(display_style, options:)
|
|
35
|
-
f_element =
|
|
36
|
-
fpr_element =
|
|
37
|
-
|
|
35
|
+
f_element = XmlHelper.ox_element("f", namespace: "m")
|
|
36
|
+
fpr_element = XmlHelper.ox_element("fPr", namespace: "m")
|
|
37
|
+
XmlHelper.update_nodes(
|
|
38
38
|
f_element,
|
|
39
39
|
[
|
|
40
|
-
fpr_element <<
|
|
40
|
+
fpr_element << XmlHelper.pr_element("ctrl", true, namespace: "m"),
|
|
41
41
|
omml_parameter(parameter_one, display_style, tag_name: "num",
|
|
42
42
|
options: options),
|
|
43
43
|
omml_parameter(parameter_two, display_style, tag_name: "den",
|
|
@@ -19,11 +19,11 @@ module Plurimath
|
|
|
19
19
|
mover[:accent] =
|
|
20
20
|
attributes[:accent]
|
|
21
21
|
end
|
|
22
|
-
|
|
22
|
+
XmlHelper.update_nodes(
|
|
23
23
|
mover,
|
|
24
24
|
[
|
|
25
25
|
first_value,
|
|
26
|
-
|
|
26
|
+
XmlHelper.ox_element("mo") << "⃡",
|
|
27
27
|
],
|
|
28
28
|
)
|
|
29
29
|
end
|
|
@@ -56,11 +56,11 @@ module Plurimath
|
|
|
56
56
|
protected
|
|
57
57
|
|
|
58
58
|
def acc_tag(display_style, options:)
|
|
59
|
-
acc_tag =
|
|
60
|
-
acc_pr_tag =
|
|
61
|
-
acc_pr_tag <<
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
acc_tag = XmlHelper.ox_element("acc", namespace: "m")
|
|
60
|
+
acc_pr_tag = XmlHelper.ox_element("accPr", namespace: "m")
|
|
61
|
+
acc_pr_tag << XmlHelper.ox_element("chr", namespace: "m",
|
|
62
|
+
attributes: { "m:val": "\u20e1" })
|
|
63
|
+
XmlHelper.update_nodes(
|
|
64
64
|
acc_tag,
|
|
65
65
|
[
|
|
66
66
|
acc_pr_tag,
|
|
@@ -26,7 +26,7 @@ module Plurimath
|
|
|
26
26
|
validate_mathml_fields(parameter_two, intent, options: options),
|
|
27
27
|
validate_mathml_fields(parameter_one, intent, options: options),
|
|
28
28
|
]
|
|
29
|
-
|
|
29
|
+
XmlHelper.update_nodes(
|
|
30
30
|
ox_element("mover", attributes: self.options),
|
|
31
31
|
value_array,
|
|
32
32
|
)
|
|
@@ -39,10 +39,10 @@ module Plurimath
|
|
|
39
39
|
options: options)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
limupp =
|
|
43
|
-
limupppr =
|
|
44
|
-
limupppr <<
|
|
45
|
-
|
|
42
|
+
limupp = XmlHelper.ox_element("limUpp", namespace: "m")
|
|
43
|
+
limupppr = XmlHelper.ox_element("limUppPr", namespace: "m")
|
|
44
|
+
limupppr << XmlHelper.pr_element("ctrl", true, namespace: "m")
|
|
45
|
+
XmlHelper.update_nodes(
|
|
46
46
|
limupp,
|
|
47
47
|
[
|
|
48
48
|
limupppr,
|
|
@@ -17,19 +17,19 @@ module Plurimath
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def to_mathml_without_math_tag(intent, options:)
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
XmlHelper.update_nodes(
|
|
21
|
+
XmlHelper.ox_element("mphantom"),
|
|
22
22
|
Array(mathml_value(intent, options: options)),
|
|
23
23
|
)
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def to_omml_without_math_tag(display_style, options:)
|
|
27
|
-
phant =
|
|
28
|
-
e_tag =
|
|
29
|
-
|
|
27
|
+
phant = XmlHelper.ox_element("phant", namespace: "m")
|
|
28
|
+
e_tag = XmlHelper.ox_element("e", namespace: "m")
|
|
29
|
+
XmlHelper.update_nodes(e_tag,
|
|
30
30
|
Array(omml_value(display_style,
|
|
31
31
|
options: options)))
|
|
32
|
-
|
|
32
|
+
XmlHelper.update_nodes(phant, [phant_pr, e_tag])
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def to_unicodemath(options:)
|
|
@@ -50,9 +50,9 @@ module Plurimath
|
|
|
50
50
|
|
|
51
51
|
def phant_pr
|
|
52
52
|
attributes = { "m:val": "off" }
|
|
53
|
-
phant =
|
|
54
|
-
phant <<
|
|
55
|
-
|
|
53
|
+
phant = XmlHelper.ox_element("phantPr", namespace: "m")
|
|
54
|
+
phant << XmlHelper.ox_element("show", namespace: "m",
|
|
55
|
+
attributes: attributes)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def phantom_symbol
|
|
@@ -29,7 +29,7 @@ module Plurimath
|
|
|
29
29
|
validate_mathml_fields(parameter_one, intent, options: options),
|
|
30
30
|
validate_mathml_fields(parameter_two, intent, options: options),
|
|
31
31
|
]
|
|
32
|
-
|
|
32
|
+
XmlHelper.update_nodes(ox_element("m#{tag_name}"), value_array)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def to_latex(options:)
|
|
@@ -45,10 +45,10 @@ module Plurimath
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def to_omml_without_math_tag(display_style, options:)
|
|
48
|
-
ssup_element =
|
|
49
|
-
suppr_element =
|
|
50
|
-
suppr_element <<
|
|
51
|
-
|
|
48
|
+
ssup_element = XmlHelper.ox_element("sSup", namespace: "m")
|
|
49
|
+
suppr_element = XmlHelper.ox_element("sSupPr", namespace: "m")
|
|
50
|
+
suppr_element << XmlHelper.pr_element("ctrl", true, namespace: "m")
|
|
51
|
+
XmlHelper.update_nodes(
|
|
52
52
|
ssup_element,
|
|
53
53
|
[
|
|
54
54
|
suppr_element,
|
|
@@ -19,7 +19,7 @@ module Plurimath
|
|
|
19
19
|
validate_mathml_fields(parameter_two, intent, options: options),
|
|
20
20
|
validate_mathml_fields(parameter_three, intent, options: options),
|
|
21
21
|
]
|
|
22
|
-
|
|
22
|
+
XmlHelper.update_nodes(subsup_tag, new_arr)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def to_latex(options:)
|
|
@@ -42,10 +42,10 @@ module Plurimath
|
|
|
42
42
|
options: options)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
ssubsup =
|
|
46
|
-
ssubsuppr =
|
|
47
|
-
ssubsuppr <<
|
|
48
|
-
|
|
45
|
+
ssubsup = XmlHelper.ox_element("sSubSup", namespace: "m")
|
|
46
|
+
ssubsuppr = XmlHelper.ox_element("sSubSupPr", namespace: "m")
|
|
47
|
+
ssubsuppr << XmlHelper.pr_element("ctrl", true, namespace: "m")
|
|
48
|
+
XmlHelper.update_nodes(
|
|
49
49
|
ssubsup,
|
|
50
50
|
[
|
|
51
51
|
ssubsuppr,
|
|
@@ -57,7 +57,7 @@ module Plurimath
|
|
|
57
57
|
first_value << invert_unicode_symbols.to_s unless hide_function_name
|
|
58
58
|
return first_value unless any_value_exist?
|
|
59
59
|
|
|
60
|
-
munderover_tag =
|
|
60
|
+
munderover_tag = XmlHelper.update_nodes(
|
|
61
61
|
prod_tag_name,
|
|
62
62
|
[
|
|
63
63
|
first_value,
|
|
@@ -73,7 +73,7 @@ module Plurimath
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
mrow = ox_element("mrow")
|
|
76
|
-
|
|
76
|
+
XmlHelper.update_nodes(
|
|
77
77
|
mrow,
|
|
78
78
|
[
|
|
79
79
|
munderover_tag,
|
|
@@ -95,8 +95,8 @@ module Plurimath
|
|
|
95
95
|
def to_omml_without_math_tag(display_style, options:)
|
|
96
96
|
return r_element("∏", rpr_tag: false) unless any_value_exist?
|
|
97
97
|
|
|
98
|
-
nary =
|
|
99
|
-
|
|
98
|
+
nary = XmlHelper.ox_element("nary", namespace: "m")
|
|
99
|
+
XmlHelper.update_nodes(nary,
|
|
100
100
|
nary_values(display_style, options: options))
|
|
101
101
|
[nary]
|
|
102
102
|
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 << right_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") << right_paren)
|
|
52
52
|
"#{spacing}\"#{dump_ox_nodes(mo_tag).gsub(/\s+/, '')}\" right\n"
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def to_omml_math_zone(spacing = "", _, _, **)
|
|
56
|
-
t_tag = (
|
|
56
|
+
t_tag = (XmlHelper.ox_element("t", namespace: "m") << right_paren)
|
|
57
57
|
"#{spacing}\"#{dump_ox_nodes(t_tag).gsub(/\s+/, '')}\" right\n"
|
|
58
58
|
end
|
|
59
59
|
|
|
@@ -15,8 +15,8 @@ module Plurimath
|
|
|
15
15
|
options: options)
|
|
16
16
|
second_value = parameter_two&.to_mathml_without_math_tag(intent,
|
|
17
17
|
options: options)
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
XmlHelper.update_nodes(
|
|
19
|
+
XmlHelper.ox_element("mroot"),
|
|
20
20
|
[second_value, first_value],
|
|
21
21
|
)
|
|
22
22
|
end
|
|
@@ -29,11 +29,11 @@ module Plurimath
|
|
|
29
29
|
|
|
30
30
|
def to_omml_without_math_tag(display_style, options:)
|
|
31
31
|
attribute = { "m:val": "off" }
|
|
32
|
-
rad_element =
|
|
33
|
-
pr_element =
|
|
34
|
-
pr_element <<
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
rad_element = XmlHelper.ox_element("rad", namespace: "m")
|
|
33
|
+
pr_element = XmlHelper.ox_element("radPr", namespace: "m")
|
|
34
|
+
pr_element << XmlHelper.ox_element("degHide", namespace: "m",
|
|
35
|
+
attributes: attribute)
|
|
36
|
+
XmlHelper.update_nodes(
|
|
37
37
|
rad_element,
|
|
38
38
|
[
|
|
39
39
|
pr_element,
|
|
@@ -23,11 +23,11 @@ module Plurimath
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def to_mathml_without_math_tag(_intent, **)
|
|
26
|
-
|
|
26
|
+
XmlHelper.ox_element("mi")
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def to_omml_without_math_tag(_, **)
|
|
30
|
-
[
|
|
30
|
+
[XmlHelper.ox_element("m:r") << XmlHelper.ox_element("m:t")]
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def to_html
|
|
@@ -13,8 +13,8 @@ module Plurimath
|
|
|
13
13
|
def to_mathml_without_math_tag(intent, options:)
|
|
14
14
|
first_value = parameter_one&.to_mathml_without_math_tag(intent,
|
|
15
15
|
options: options)
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
XmlHelper.update_nodes(
|
|
17
|
+
XmlHelper.ox_element("semantics"),
|
|
18
18
|
other_tags(parameter_two, intent, options: options).insert(0,
|
|
19
19
|
first_value),
|
|
20
20
|
)
|
|
@@ -48,8 +48,8 @@ module Plurimath
|
|
|
48
48
|
contented = []
|
|
49
49
|
array&.each do |hash|
|
|
50
50
|
hash.each do |tag, content|
|
|
51
|
-
tag_element =
|
|
52
|
-
contented <<
|
|
51
|
+
tag_element = XmlHelper.ox_element(tag&.to_s)
|
|
52
|
+
contented << XmlHelper.update_nodes(
|
|
53
53
|
tag_element,
|
|
54
54
|
content&.map { |object|
|
|
55
55
|
object&.to_mathml_without_math_tag(intent, options: options)
|
|
@@ -7,7 +7,7 @@ module Plurimath
|
|
|
7
7
|
attr_accessor :options
|
|
8
8
|
|
|
9
9
|
def to_mathml_without_math_tag(intent, options:)
|
|
10
|
-
|
|
10
|
+
XmlHelper.update_nodes(
|
|
11
11
|
ox_element("msqrt"),
|
|
12
12
|
Array(parameter_one&.to_mathml_without_math_tag(intent,
|
|
13
13
|
options: options)),
|
|
@@ -15,18 +15,18 @@ module Plurimath
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def to_omml_without_math_tag(display_style, options:)
|
|
18
|
-
rad_element =
|
|
19
|
-
pr_element =
|
|
20
|
-
pr_element <<
|
|
18
|
+
rad_element = XmlHelper.ox_element("rad", namespace: "m")
|
|
19
|
+
pr_element = XmlHelper.ox_element("radPr", namespace: "m")
|
|
20
|
+
pr_element << XmlHelper.ox_element(
|
|
21
21
|
"degHide",
|
|
22
22
|
namespace: "m",
|
|
23
23
|
attributes: { "m:val": "on" },
|
|
24
24
|
)
|
|
25
|
-
|
|
25
|
+
XmlHelper.update_nodes(
|
|
26
26
|
rad_element,
|
|
27
27
|
[
|
|
28
|
-
(pr_element <<
|
|
29
|
-
|
|
28
|
+
(pr_element << XmlHelper.pr_element("ctrl", true, namespace: "m")),
|
|
29
|
+
XmlHelper.ox_element("deg", namespace: "m"),
|
|
30
30
|
omml_parameter(parameter_one, display_style, tag_name: "e",
|
|
31
31
|
options: options),
|
|
32
32
|
],
|