Class: Plurimath::Math::Function::PowerBase
Instance Attribute Summary
#parameter_one, #parameter_three, #parameter_two
Instance Method Summary
collapse
#==, #class_name, #initialize, #to_asciimath
Methods inherited from Core
#class_name, #empty_tag, #insert_t_tag, #nary_attr_value, #omml_parameter, #tag_name, #validate_function_formula
Instance Method Details
#omml_nary_tag ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/plurimath/math/function/power_base.rb', line 32
def omml_nary_tag
narypr = Utility.ox_element("naryPr", namespace: "m")
chr_value(narypr)
narypr << Utility.ox_element(
"limLoc",
namespace: "m",
attributes: { "m:val": "subSup" },
)
hide_tags(narypr)
narypr << Utility.pr_element("ctrl", true, namespace: "m")
[
narypr,
omml_parameter(parameter_two, tag_name: "sub"),
omml_parameter(parameter_three, tag_name: "sup"),
]
end
|
#to_html ⇒ Object
25
26
27
28
29
30
|
# File 'lib/plurimath/math/function/power_base.rb', line 25
def to_html
first_value = "<i>#{parameter_one.to_html}</i>" if parameter_one
second_value = "<sub>#{parameter_two.to_html}</sub>" if parameter_two
third_value = "<sup>#{parameter_three.to_html}</sup>" if parameter_three
"#{first_value}#{second_value}#{third_value}"
end
|
#to_latex ⇒ Object
18
19
20
21
22
23
|
# File 'lib/plurimath/math/function/power_base.rb', line 18
def to_latex
first_value = parameter_one.to_latex if parameter_one
second_value = parameter_two.to_latex if parameter_two
third_value = parameter_three.to_latex if parameter_three
"#{first_value}_{#{second_value}}^{#{third_value}}"
end
|
#to_mathml_without_math_tag ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/plurimath/math/function/power_base.rb', line 9
def to_mathml_without_math_tag
subsup_tag = Utility.ox_element("m#{parameter_one.tag_name}")
new_arr = []
new_arr << parameter_one.to_mathml_without_math_tag
new_arr << parameter_two&.to_mathml_without_math_tag
new_arr << parameter_three&.to_mathml_without_math_tag
Utility.update_nodes(subsup_tag, new_arr)
end
|
#to_omml_without_math_tag ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/plurimath/math/function/power_base.rb', line 49
def to_omml_without_math_tag
ssubsup = Utility.ox_element("sSubSup", namespace: "m")
ssubsuppr = Utility.ox_element("sSubSupPr", namespace: "m")
ssubsuppr << hide_tags(
Utility.pr_element("ctrl", true, namespace: "m"),
)
Utility.update_nodes(
ssubsup,
[
ssubsuppr,
omml_parameter(parameter_one, tag_name: "e"),
omml_parameter(parameter_two, tag_name: "sub"),
omml_parameter(parameter_three, tag_name: "sup"),
],
)
[ssubsup]
end
|