Sha256: f713b492ec6f5edc7fa56a6197cfb4e29754d257e06b6b172946ece5ecc2c877
Contents?: true
Size: 831 Bytes
Versions: 5
Compression:
Stored size: 831 Bytes
Contents
# Unless run with Coradoc::Input::HTML.config.mathml2asciimath, # this is cheating: we're injecting MathML into Asciidoctor, but # Asciidoctor only understands AsciiMath or LaTeX require "mathml2asciimath" module Coradoc::Input::HTML module Converters class Math < Base # FIXIT def to_coradoc(node, state = {}) convert(node, state) end def convert(node, _state = {}) stem = node.to_s.gsub(/\n/, " ") stem = MathML2AsciiMath.m2a(stem) if Coradoc::Input::HTML.config.mathml2asciimath unless stem.nil? stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub( /\(\(([^\)]+)\)\)/, "(\\1)" ) end # TODO: This is to be done in Coradoc " stem:[" << stem << "] " end end register :math, Math.new end end
Version data entries
5 entries across 5 versions & 1 rubygems