You are here

function mathjax_filter in MathJax: LaTeX for Drupal 6

Implements hook_filter().

File

./mathjax.module, line 123
MathJax module.

Code

function mathjax_filter($op, $delta = 0, $format = -1, $text = '', $cache_id = 0) {
  switch ($op) {
    case 'list':
      return array(
        0 => t('MathJax filter'),
      );
    case 'description':
      return t('JavaScript display engine for mathematics using LaTeX.');
    case 'prepare':

      // Format the equation input according to the different display styles.
      $text = preg_replace('/\\$\\$(.*?)\\$\\$/m', '[mathjax:block \\1]', $text);
      $text = preg_replace('/\\$(.*?)\\$/m', '[mathjax:inline \\1]', $text);
      return $text;
    case 'process':
      return $text;
  }
}