Class: Plurimath::Math::Function::Fenced
Instance Attribute Summary
#parameter_one, #parameter_three, #parameter_two
Instance Method Summary
collapse
#==, #class_name, #initialize
Instance Method Details
#to_asciimath ⇒ Object
9
10
11
12
13
|
# File 'lib/plurimath/math/function/fenced.rb', line 9
def to_asciimath
first_value = parameter_one ? parameter_one.to_asciimath : "("
third_value = parameter_three ? parameter_three.to_asciimath : ")"
"#{first_value}#{parameter_two&.map(&:to_asciimath)&.join(' ')}#{third_value}"
end
|
#to_html ⇒ Object
25
26
27
28
29
30
|
# File 'lib/plurimath/math/function/fenced.rb', line 25
def to_html
first_value = "<i>#{parameter_one.value}</i>" if parameter_one
second_value = parameter_two.map(&:to_html).join if parameter_two
third_value = "<i>#{parameter_three.value}</i>" if parameter_three
"#{first_value}#{second_value}#{third_value}"
end
|
#to_latex ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/plurimath/math/function/fenced.rb', line 32
def to_latex
open_paren = parameter_one ? parameter_one.value : "("
fenced_value = parameter_two&.map(&:to_latex)&.join(" ")
close_paren = parameter_three ? parameter_three.value : ")"
first_value = latex_paren(open_paren, false)
second_value = latex_paren(close_paren, true)
"#{first_value}#{fenced_value}#{second_value}"
end
|
#to_mathml_without_math_tag ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/plurimath/math/function/fenced.rb', line 15
def to_mathml_without_math_tag
first_value = Utility.ox_element("mo") << (mathml_paren(parameter_one) || "")
second_value = parameter_two&.map(&:to_mathml_without_math_tag) || []
third_value = Utility.ox_element("mo") << (mathml_paren(parameter_three) || "")
Utility.update_nodes(
Utility.ox_element("mrow"),
(second_value.insert(0, first_value) << third_value),
)
end
|
#to_omml_without_math_tag ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/plurimath/math/function/fenced.rb', line 41
def to_omml_without_math_tag
d = Utility.ox_element("d", namespace: "m")
dpr = Utility.ox_element("dPr", namespace: "m")
first_value(dpr)
third_value(dpr)
dpr << Utility.pr_element("ctrl", true, namespace: "m")
Utility.update_nodes(
d,
[dpr] + second_value,
)
end
|