Module | MathML::Util |
In: |
lib/math_ml/util.rb
|
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]?/ |
# 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
# 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
# File lib/math_ml/util.rb, line 40 40: def collect_regexp(a) 41: MathML::Util.collect_regexp(a) 42: end