Sha256: 72325f010e58df8ab6473849b205ed02af8909f0714debfdc921bdff58e04e85
Contents?: true
Size: 617 Bytes
Versions: 9
Compression:
Stored size: 617 Bytes
Contents
# Unless run with ReverseAdoc.config.mathml2asciimath, # this is cheating: we're injecting MathML into Asciidoctor, but # Asciidoctor only understands AsciiMath or LaTeX require "mathml2asciimath" module ReverseAdoc module Converters class Math < Base def convert(node, state = {}) stem = node.to_s.gsub(/\n/, " ") stem = MathML2AsciiMath.m2a(stem) if ReverseAdoc.config.mathml2asciimath stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(/\(\(([^\)]+)\)\)/, "(\\1)") unless stem.nil? " stem:[" << stem << "] " end end register :math, Math.new end end
Version data entries
9 entries across 9 versions & 1 rubygems