Class: Plurimath::Math::Function::Tr
Instance Attribute Summary
#parameter_one
Instance Method Summary
collapse
#==, #initialize
Methods inherited from Core
#class_name, #empty_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
|
# File 'lib/plurimath/math/function/tr.rb', line 9
def to_asciimath
"[#{parameter_one.map(&:to_asciimath).join(', ')}]"
end
|
#to_html ⇒ Object
29
30
31
32
|
# File 'lib/plurimath/math/function/tr.rb', line 29
def to_html
first_value = parameter_one.map(&:to_html).join
"<tr>#{first_value}</tr>"
end
|
#to_latex ⇒ Object
23
24
25
26
27
|
# File 'lib/plurimath/math/function/tr.rb', line 23
def to_latex
parameter_one.reject do |td|
td if Utility.symbol_value(td, "|") || Utility.symbol_value(td.parameter_one.first, "|")
end.map(&:to_latex).join(" & ")
end
|
#to_mathml_without_math_tag ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/plurimath/math/function/tr.rb', line 13
def to_mathml_without_math_tag
first_value = parameter_one.dup
row_lines = first_value.first.parameter_one
row_lines.shift if Utility.symbol_value(row_lines.first, "⎯")
Utility.update_nodes(
Utility.ox_element("mtr"),
first_value.map(&:to_mathml_without_math_tag).compact,
)
end
|
#to_omml_without_math_tag ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/plurimath/math/function/tr.rb', line 34
def to_omml_without_math_tag
omml_content = parameter_one&.map(&:to_omml_without_math_tag)
if parameter_one.count.eql?(1)
omml_content
else
mr = Utility.ox_element("mr", namespace: "m")
Utility.update_nodes(
mr,
omml_content,
)
[mr]
end
end
|