Class: Plurimath::Math::Function::Fenced
Constant Summary
Constants inherited
from Core
Core::REPLACABLES
Instance Attribute Summary
#hide_function_name, #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, #cloned_objects, #common_math_zone_conversion, #dump_mathml, #dump_nodes, #dump_omml, #dump_ox_nodes, #empty_tag, #extract_class_name_from_text, #extractable?, #filtered_values, #font_style_t_tag, #get, #gsub_spacing, #insert_t_tag, #invert_unicode_symbols, #is_unary?, #latex_fields_to_print, #linebreak, #mathml_fields_to_print, #nary_attr_value, #omml_fields_to_print, #omml_nodes, #omml_parameter, #omml_tag_name, #ox_element, #r_element, #replacable_values, #result, #separate_table, #set, #tag_name, #updated_object_values, #validate_function_formula, #validate_mathml_fields, #variable_value, #variables
Instance Method Details
#line_breaking(obj) ⇒ Object
78
79
80
81
82
83
|
# File 'lib/plurimath/math/function/fenced.rb', line 78
def line_breaking(obj)
field_values = result(Array(parameter_two))
return unless field_values.length > 1
obj.update(value_split(obj, field_values))
end
|
#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
51
52
53
54
55
56
|
# File 'lib/plurimath/math/function/fenced.rb', line 51
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
58
59
60
61
62
63
|
# File 'lib/plurimath/math/function/fenced.rb', line 58
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
65
66
67
68
69
70
|
# File 'lib/plurimath/math/function/fenced.rb', line 65
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
72
73
74
75
76
|
# File 'lib/plurimath/math/function/fenced.rb', line 72
def to_omml_math_zone(spacing, last = false, indent = true, display_style:)
filtered_values(parameter_two).map do |object|
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
|
# 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")
parameter = Formula.new(Array(parameter_two))
open_paren(dpr)
close_paren(dpr)
fenced_value = omml_parameter(parameter, display_style, tag_name: "e")
dpr << Utility.pr_element("ctrl", true, namespace: "m")
Utility.update_nodes(d, [dpr, fenced_value])
[d]
end
|