Class: Plurimath::Math::Function::Ul
Instance Attribute Summary collapse
#parameter_one
Instance Method Summary
collapse
#==, #to_html
Methods inherited from Core
#empty_tag, #extract_class_from_text, #extractable?, #font_style_t_tag, #insert_t_tag, #nary_attr_value, #omml_parameter, #omml_tag_name, #r_element, #tag_name, #validate_function_formula
Constructor Details
#initialize(parameter_one = nil, attributes = {}) ⇒ Ul
Returns a new instance of Ul.
11
12
13
14
|
# File 'lib/plurimath/math/function/ul.rb', line 11
def initialize(parameter_one = nil, attributes = {})
super(parameter_one)
@attributes = attributes
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
9
10
11
|
# File 'lib/plurimath/math/function/ul.rb', line 9
def attributes
@attributes
end
|
Instance Method Details
#class_name ⇒ Object
52
53
54
|
# File 'lib/plurimath/math/function/ul.rb', line 52
def class_name
"underline"
end
|
#swap_class ⇒ Object
56
57
58
|
# File 'lib/plurimath/math/function/ul.rb', line 56
def swap_class
Bar.new(parameter_one, attributes)
end
|
#to_asciimath ⇒ Object
16
17
18
19
|
# File 'lib/plurimath/math/function/ul.rb', line 16
def to_asciimath
first_value = "(#{parameter_one.to_asciimath})" if parameter_one
"underline#{first_value}"
end
|
#to_latex ⇒ Object
21
22
23
24
|
# File 'lib/plurimath/math/function/ul.rb', line 21
def to_latex
first_value = "{#{parameter_one.to_latex}}" if parameter_one
"\\underline#{first_value}"
end
|
#to_mathml_without_math_tag ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/plurimath/math/function/ul.rb', line 26
def to_mathml_without_math_tag
mo_tag = Utility.ox_element("mo") << "̲"
return mo_tag unless parameter_one
munder_tag = Utility.ox_element("munder")
munder_tag.attributes.merge!(attributes) if attributes && !attributes.empty?
Utility.update_nodes(
munder_tag,
[
parameter_one&.to_mathml_without_math_tag,
mo_tag,
],
)
end
|
#to_omml_without_math_tag(display_style) ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/plurimath/math/function/ul.rb', line 41
def to_omml_without_math_tag(display_style)
return r_element("̲", rpr_tag: false) unless parameter_one
if attributes && attributes[:accentunder]
groupchr_tag(display_style)
else
symbol = Symbol.new("̲")
Underset.new(parameter_one, symbol).to_omml_without_math_tag(true)
end
end
|