Class: Plurimath::Math::Function::Text

Inherits:
UnaryFunction show all
Defined in:
lib/plurimath/math/function/text.rb

Constant Summary collapse

PARSER_REGEX =
%r{unicode\[:(?<unicode>\w{1,})\]}.freeze

Instance Attribute Summary

Attributes inherited from UnaryFunction

#parameter_one

Instance Method Summary collapse

Methods inherited from UnaryFunction

#==, #initialize

Methods inherited from Core

#class_name, #empty_tag, #extract_class_from_text, #extractable?, #font_style_t_tag, #nary_attr_value, #omml_parameter, #omml_tag_name, #r_element, #tag_name

Constructor Details

This class inherits a constructor from Plurimath::Math::Function::UnaryFunction

Instance Method Details

#insert_t_tag(display_style) ⇒ Object



36
37
38
39
40
# File 'lib/plurimath/math/function/text.rb', line 36

def insert_t_tag(display_style)
  r_tag = Utility.ox_element("r", namespace: "m")
  Utility.update_nodes(r_tag, to_omml_without_math_tag(display_style))
  [r_tag]
end

#to_asciimathObject



12
13
14
# File 'lib/plurimath/math/function/text.rb', line 12

def to_asciimath
  "\"#{parse_text('asciimath') || parameter_one}\""
end

#to_htmlObject



26
27
28
# File 'lib/plurimath/math/function/text.rb', line 26

def to_html
  parse_text("html") || parameter_one
end

#to_latexObject



21
22
23
24
# File 'lib/plurimath/math/function/text.rb', line 21

def to_latex
  text_value = parse_text("latex") || parameter_one
  "\\text{#{text_value}}"
end

#to_mathml_without_math_tagObject



16
17
18
19
# File 'lib/plurimath/math/function/text.rb', line 16

def to_mathml_without_math_tag
  text = Utility.ox_element("mtext")
  text << (parse_text("mathml") || parameter_one) if parameter_one
end

#to_omml_without_math_tag(_display_style) ⇒ Object



30
31
32
33
34
# File 'lib/plurimath/math/function/text.rb', line 30

def to_omml_without_math_tag(_display_style)
  text = Utility.ox_element("t", namespace: "m")
  text << (parse_text("omml") || parameter_one)
  [text]
end

#validate_function_formulaObject



42
43
44
# File 'lib/plurimath/math/function/text.rb', line 42

def validate_function_formula
  false
end