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



26
27
28
29
30
# File 'lib/plurimath/math/core.rb', line 26

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



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

def nary_attr_value
  ""
end

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



32
33
34
35
36
37
38
39
40
# File 'lib/plurimath/math/core.rb', line 32

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

#omml_tag_nameObject



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

def omml_tag_name
  "subSup"
end

#r_element(string, rpr_tag: true) ⇒ Object



46
47
48
49
50
51
52
53
54
# File 'lib/plurimath/math/core.rb', line 46

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



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

def validate_function_formula
  true
end