parsing.rb

Path: lib/maruku/ext/math/parsing.rb
Last Update: Thu Feb 18 08:06:09 +0000 2010

Constants

RegInlineMath = /\${1}((?:[^\$]|\\\$)+)\$/   Everything goes; takes care of escaping the "\$" inside the expression
MathOpen1 = Regexp.escape('\\begin{equation}')
MathClose1 = Regexp.escape('\\end{equation}')
MathOpen2 = Regexp.escape('\\[')
MathClose2 = Regexp.escape('\\]')
MathOpen3 = Regexp.escape('$$')
MathClose3 = Regexp.escape('$$')
EqLabel = /(?:\((\w+)\))/
EquationOpen = /#{MathOpen1}|#{MathOpen2}|#{MathOpen3}/
EquationClose = /#{MathClose1}|#{MathClose2}|#{MathClose3}/
EquationStart = /^[ ]{0,3}(#{EquationOpen})(.*)$/   $1 is opening, $2 is tex
EquationEnd = /^(.*)(#{EquationClose})\s*#{EqLabel}?\s*$/   $1 is tex, $2 is closing, $3 is tex
OneLineEquation = /^[ ]{0,3}(#{EquationOpen})(.*)(#{EquationClose})\s*#{EqLabel}?\s*$/   $1 is opening, $2 is tex, $3 is closing, $4 is label
RegEqrefLatex = /\\eqref\{(\w+)\}/   This adds support for \eqref
RegEqPar = /\(eq:(\w+)\)/
RegEqref = Regexp::union(RegEqrefLatex, RegEqPar)
RegRef = /\\ref\{(\w*)\}/   This adds support for \ref

[Validate]