Class: ReverseAsciidoctor::Converters::Math

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

Instance Method Summary collapse

Methods inherited from Base

#escape_keychars, #extract_title, #treat, #treat_children

Instance Method Details

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



10
11
12
13
14
15
# File 'lib/reverse_asciidoctor/converters/math.rb', line 10

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