Class: Plurimath::Math::Function::Color
Constant Summary
collapse
- FUNCTION =
{
name: "color",
first_value: "mathcolor",
second_value: "text",
}.freeze
Constants inherited
from Core
Core::REPLACABLES
Instance Attribute Summary
#hide_function_name, #parameter_one, #parameter_two
Instance Method Summary
collapse
#==, #all_values_exist?, #any_value_exist?, #initialize, #to_asciimath_math_zone, #to_html, #to_latex_math_zone, #to_mathml_math_zone
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, #line_breaking, #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
#to_asciimath ⇒ Object
15
16
17
18
19
|
# File 'lib/plurimath/math/function/color.rb', line 15
def to_asciimath
first_value = "(#{parameter_one&.to_asciimath&.gsub(/\s/, '')})"
second_value = "(#{parameter_two&.to_asciimath})"
"color#{first_value}#{second_value}"
end
|
#to_latex ⇒ Object
31
32
33
34
35
|
# File 'lib/plurimath/math/function/color.rb', line 31
def to_latex
first_value = parameter_one&.to_asciimath&.gsub(/\s/, "")
second_value = parameter_two&.to_latex
"{\\#{class_name}{#{first_value}} #{second_value}}"
end
|
#to_mathml_without_math_tag ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/plurimath/math/function/color.rb', line 21
def to_mathml_without_math_tag
Utility.update_nodes(
Utility.ox_element(
"mstyle",
attributes: { mathcolor: parameter_one&.to_asciimath&.gsub(/\s/, "")&.gsub(/"/, "") },
),
[parameter_two&.to_mathml_without_math_tag],
)
end
|
#to_omml_math_zone(spacing, last = false, _, display_style:) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/plurimath/math/function/color.rb', line 41
def to_omml_math_zone(spacing, last = false, _, display_style:)
parameters = self.class::FUNCTION
new_spacing = gsub_spacing(spacing, last)
new_arr = ["#{spacing}\"#{dump_omml(self, display_style)}\" #{parameters[:name]}\n"]
omml_fields_to_print(parameter_two, { spacing: new_spacing, field_name: "text", additional_space: "| |_ ", array: new_arr, display_style: display_style })
new_arr
end
|
#to_omml_without_math_tag(display_style) ⇒ Object
37
38
39
|
# File 'lib/plurimath/math/function/color.rb', line 37
def to_omml_without_math_tag(display_style)
Array(parameter_two.insert_t_tag(display_style))
end
|