function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); if (empty($this->source)) { return ''; } include_once "lib/ASCIIMathPHP/ASCIIMathPHP.cfg.php"; $ascii_math = new ASCIIMathPHP($symbol_arr, $this->source); $ascii_math->genMathML(); return HTML::Raw($ascii_math->getMathML()); }
/** * ASCIIMathML parser * http://tinyurl.com/ASCIIMathPHP * * @PARAM mtch_arr array - Array of ASCIIMath expressions * as returned by preg_replace_callback([pattern]). First * dimension is the full matched string (with delimiter); * 2nd dimension is the undelimited contents (typically * a capture group). * **********************************************************/ function ASCIIMathPHPCallback($mtch_arr) { $txt = trim($mtch_arr[1]); static $asciimath; if (!isset($asciimath)) { $asciimath = new ASCIIMathPHP($symbol_arr); } $math_attr_arr = array('displaystyle' => 'true'); $asciimath->setExpr($txt); $asciimath->genMathML($math_attr_arr); return $asciimath->getMathML(); }
function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); if (empty($this->source)) { return HTML::div(array('class' => "error"), "Please provide a formula to AsciiMath plugin"); } if (phpversion() >= '5') { include "lib/ASCIIMathPHP/ASCIIMathPHP-2.0.cfg.php"; } else { include "lib/ASCIIMathPHP/ASCIIMathPHP.cfg.php"; } $ascii_math = new ASCIIMathPHP($symbol_arr, $this->source); $ascii_math->genMathML(); return HTML::raw($ascii_math->getMathML()); }
/** * ASCIIMathML parser * http://tinyurl.com/ASCIIMathPHP * * @PARAM mtch_arr array - Array of ASCIIMath expressions * as returned by preg_replace_callback([pattern]). First * dimension is the full matched string (with delimiter); * 2nd dimension is the undelimited contents (typically * a capture group). * **********************************************************/ function ASCIIMathPHPCallback($mtch_arr) { $txt = trim($mtch_arr[1]); include 'includes/ASCIIMathPHP-2.0/ASCIIMathPHP-2.0.cfg.php'; require_once 'includes/ASCIIMathPHP-2.0/ASCIIMathPHP-2.0.class.php'; static $asciimath; if (!isset($asciimath)) { $asciimath = new ASCIIMathPHP($symbol_arr); } $math_attr_arr = array('displaystyle' => 'true'); $asciimath->setExpr($txt); $asciimath->genMathML($math_attr_arr); return $asciimath->getMathML(); }