Module MathML::Util
In: lib/math_ml/util.rb

Methods

Classes and Modules

Class MathML::Util::MathData
Class MathML::Util::SimpleLaTeX

Constants

ESCAPES = {"<"=>"lt", ">"=>"gt", "&"=>"amp", "\""=>"quot", "'"=>"apos"
INVALID_RE = /(?!)/
EQNARRAY_RE = /\\begin\s*\{eqnarray\}(#{MathML::LaTeX::MBEC}*?)\\end\s*\{eqnarray\}/
SINGLE_COMMAND_RE = /(\\([a-zA-Z]+))[ \t]?/

Public Class methods

[Source]

    # File lib/math_ml/util.rb, line 31
31:         def self.collect_regexp(a)
32:                 if a
33:                         a = [a].flatten
34:                         a.size>0 ? Regexp.new(a.inject(""){|r, i| i.is_a?(Regexp) ? "#{r}#{i.to_s}|" : r}.chop) : INVALID_RE
35:                 else
36:                         INVALID_RE
37:                 end
38:         end

[Source]

    # File lib/math_ml/util.rb, line 22
22:         def self.escapeXML(s, br=false)
23:                 r = s.gsub(/[<>&"']/){|m| "&#{ESCAPES[m]};"}
24:                 br ? r.gsub(/\n/, "<br />\n") : r
25:         end

Public Instance methods

[Source]

    # File lib/math_ml/util.rb, line 40
40:         def collect_regexp(a)
41:                 MathML::Util.collect_regexp(a)
42:         end

[Source]

    # File lib/math_ml/util.rb, line 27
27:         def escapeXML(s, br=false)
28:                 MathML::Util.escapeXML(s, br)
29:         end

[Validate]