Class: Plurimath::Math::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/plurimath/math/core.rb

Instance Method Summary collapse

Instance Method Details

#class_nameObject



6
7
8
# File 'lib/plurimath/math/core.rb', line 6

def class_name
  self.class.name.split("::").last.downcase
end

#empty_tag(wrapper_tag) ⇒ Object



22
23
24
25
26
# File 'lib/plurimath/math/core.rb', line 22

def empty_tag(wrapper_tag)
  r_tag = Utility.ox_element("r", namespace: "m")
  r_tag << (Utility.ox_element("t", namespace: "m") << "&#8203;")
  wrapper_tag << r_tag
end

#insert_t_tagObject



10
11
12
# File 'lib/plurimath/math/core.rb', line 10

def insert_t_tag
  Array(to_omml_without_math_tag)
end

#nary_attr_valueObject



18
19
20
# File 'lib/plurimath/math/core.rb', line 18

def nary_attr_value
  ""
end

#omml_parameter(field, tag_name:, namespace: "m") ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/plurimath/math/core.rb', line 28

def omml_parameter(field, tag_name: , namespace: "m")
  tag = Utility.ox_element(tag_name, namespace: namespace)
  return empty_tag(tag) unless field

  Utility.update_nodes(
    tag,
    field&.insert_t_tag,
  )
end

#r_element(string, rpr_tag: true) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/plurimath/math/core.rb', line 42

def r_element(string, rpr_tag: true)
  r_tag = Utility.ox_element("r", namespace: "m")
  if rpr_tag
    sty_tag = Utility.ox_element("sty", namespace: "m", attributes: { "m:val": "p" })
    r_tag << (Utility.ox_element("rPr", namespace: "m") << sty_tag)
  end
  r_tag << (Utility.ox_element("t", namespace: "m") << string)
  Array(r_tag)
end

#tag_nameObject



14
15
16
# File 'lib/plurimath/math/core.rb', line 14

def tag_name
  "subsup"
end

#validate_function_formulaObject



38
39
40
# File 'lib/plurimath/math/core.rb', line 38

def validate_function_formula
  true
end