1<?php
2
3require_once(realpath(dirname(__FILE__).'/../latexinc.php'));
4
5class syntax_plugin_latex_eqnarray extends syntax_plugin_latex_common {
6   /**
7    * return some info
8    */
9    function getInfo(){
10		$a = parent::getInfo();
11		$a['name'] = '\\begin{eqnarray} ... \\end{eqnarray} syntax';
12		return $a;
13    }
14    function connectTo($mode) {
15      $this->Lexer->addEntryPattern('\x5Cbegin\{eqnarray\}(?=.*\x5Cend\{eqnarray\})',
16				    $mode,'plugin_latex_eqnarray');
17    }
18    function postConnect() {
19      $this->Lexer->addExitPattern('\x5Cend\{eqnarray\}','plugin_latex_eqnarray');
20    }
21
22		function getPType(){return 'stack';}
23
24   /**
25    * Handle the match
26    */
27    function handle($match, $state, $pos, &$handler){
28	  if($state != DOKU_LEXER_UNMATCHED)
29		return array($match,$state,NULL);
30	  return array("\\begin{eqnarray}".$match."\\end{eqnarray}",$state,'class'=>"latex_displayed", 'title'=>"Equations", NULL);
31    }
32
33 }
34