Class: Plurimath::Math::Function::Fenced
Instance Attribute Summary
#parameter_one, #parameter_three, #parameter_two
Instance Method Summary
collapse
#==, #all_values_exist?, #any_value_exist?, #initialize
Methods inherited from Core
#ascii_fields_to_print, #class_name, #common_math_zone_conversion, #dump_mathml, #dump_omml, #dump_ox_nodes, #empty_tag, #extract_class_from_text, #extractable?, #filtered_values, #font_style_t_tag, #gsub_spacing, #insert_t_tag, #invert_unicode_symbols, #latex_fields_to_print, #mathml_fields_to_print, #nary_attr_value, #omml_fields_to_print, #omml_nodes, #omml_parameter, #omml_tag_name, #r_element, #tag_name, #validate_function_formula, #validate_mathml_fields
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_asciimath_math_zone(spacing, last = false, indent = true) ⇒ Object
59
60
61
62
63
64
|
# File 'lib/plurimath/math/function/fenced.rb', line 59
def to_asciimath_math_zone(spacing, last = false, indent = true)
filtered_values(parameter_two).map.with_index(1) do |object, index|
last = index == @values.length
object.to_asciimath_math_zone(spacing, last, indent)
end
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
|
# File 'lib/plurimath/math/function/fenced.rb', line 32
def to_latex
fenced_value = parameter_two&.map(&:to_latex)&.join(" ")
first_value = latex_paren(parameter_one&.value)
second_value = latex_paren(parameter_three&.value)
"#{first_value} #{fenced_value} #{second_value}"
end
|
#to_latex_math_zone(spacing, last = false, indent = true) ⇒ Object
66
67
68
69
70
71
|
# File 'lib/plurimath/math/function/fenced.rb', line 66
def to_latex_math_zone(spacing, last = false, indent = true)
filtered_values(parameter_two).map.with_index(1) do |object, index|
last = index == @values.length
object.to_latex_math_zone(spacing, last, indent)
end
end
|
#to_mathml_math_zone(spacing, last = false, indent = true) ⇒ Object
73
74
75
76
77
78
|
# File 'lib/plurimath/math/function/fenced.rb', line 73
def to_mathml_math_zone(spacing, last = false, indent = true)
filtered_values(parameter_two).map.with_index(1) do |object, index|
last = index == @values.length
object.to_mathml_math_zone(spacing, last, indent)
end
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_math_zone(spacing, last = false, indent = true, display_style:) ⇒ Object
80
81
82
83
84
|
# File 'lib/plurimath/math/function/fenced.rb', line 80
def to_omml_math_zone(spacing, last = false, indent = true, display_style:)
filtered_values(parameter_two).map.with_index(1) do |object, index|
object.to_omml_math_zone(spacing, last, !indent, display_style: display_style)
end
end
|
#to_omml_without_math_tag(display_style) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/plurimath/math/function/fenced.rb', line 39
def to_omml_without_math_tag(display_style)
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,
omml_parameter(
Formula.new(Array(parameter_two)),
display_style,
tag_name: "e",
),
],
)
[d]
end
|