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