Class: Plurimath::Math::Function::Log
Instance Attribute Summary
#parameter_one, #parameter_two
Instance Method Summary
collapse
#==, #all_values_exist?, #any_value_exist?, #initialize
Methods inherited from Core
#class_name, #empty_tag, #extract_class_from_text, #extractable?, #font_style_t_tag, #insert_t_tag, #nary_attr_value, #omml_parameter, #omml_tag_name, #r_element, #tag_name, #validate_function_formula
Instance Method Details
#to_asciimath ⇒ Object
9
10
11
12
13
|
# File 'lib/plurimath/math/function/log.rb', line 9
def to_asciimath
first_value = "_#{wrapped(parameter_one)}" if parameter_one
second_value = "^#{wrapped(parameter_two)}" if parameter_two
"log#{first_value}#{second_value}"
end
|
#to_html ⇒ Object
21
22
23
24
25
|
# File 'lib/plurimath/math/function/log.rb', line 21
def to_html
first_value = "<sub>#{parameter_one.to_html}</sub>" if parameter_one
second_value = "<sup>#{parameter_two.to_html}</sup>" if parameter_two
"<i>log</i>#{first_value}#{second_value}"
end
|
#to_latex ⇒ Object
15
16
17
18
19
|
# File 'lib/plurimath/math/function/log.rb', line 15
def to_latex
first_value = "_#{latex_wrapped(parameter_one)}" if parameter_one
second_value = "^#{latex_wrapped(parameter_two)}" if parameter_two
"\\log#{first_value}#{second_value}"
end
|
#to_mathml_without_math_tag ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/plurimath/math/function/log.rb', line 47
def to_mathml_without_math_tag
subsup_tag = Utility.ox_element("msubsup")
first_value = (Utility.ox_element("mi") << "log")
if parameter_one || parameter_two
new_arr = [first_value]
new_arr << parameter_one&.to_mathml_without_math_tag
new_arr << parameter_two&.to_mathml_without_math_tag
Utility.update_nodes(
subsup_tag,
new_arr,
)
else
first_value
end
end
|
#to_omml_without_math_tag(display_style) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/plurimath/math/function/log.rb', line 27
def to_omml_without_math_tag(display_style)
return r_element("log", rpr_tag: false) unless all_values_exist?
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,
e_parameter,
omml_parameter(parameter_one, display_style, tag_name: "sub"),
omml_parameter(parameter_two, display_style, tag_name: "sup"),
],
)
[ssubsup]
end
|