Class: ReverseAdoc::Converters::Math

Inherits:
Base
  • Object
show all
Defined in:
lib/reverse_adoc/converters/math.rb

Instance Method Summary collapse

Methods inherited from Base

#constrained?, #escape_keychars, #extract_title, #node_has_ancestor?, #textnode_before_end_with?, #treat, #treat_children, #treat_children_coradoc, #treat_coradoc, #unconstrained_after?, #unconstrained_before?

Instance Method Details

#convert(node, _state = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/reverse_adoc/converters/math.rb', line 15

def convert(node, _state = {})
  stem = node.to_s.gsub(/\n/, " ")
  stem = MathML2AsciiMath.m2a(stem) if ReverseAdoc.config.mathml2asciimath
  unless stem.nil?
    stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(
      /\(\(([^\)]+)\)\)/, "(\\1)"
    )
  end

  # TODO: This is to be done in Coradoc
  " stem:[" << stem << "] "
end

#to_coradoc(node, state = {}) ⇒ Object

FIXIT



11
12
13
# File 'lib/reverse_adoc/converters/math.rb', line 11

def to_coradoc(node, state = {})
  convert(node, state)
end