1<?php
2
3require_once(realpath(dirname(__FILE__).'/../latexinc.php'));
4
5class syntax_plugin_latex_dollar extends syntax_plugin_latex_common {
6   /**
7    * return some info
8    */
9    function getInfo(){
10		$a = parent::getInfo();
11		$a['name'] = '$...$ syntax for inline LaTeX-math';
12		return $a;
13    }
14
15    function connectTo($mode) {
16      $this->Lexer->addEntryPattern('\$(?=.*\$)',$mode,'plugin_latex_dollar');
17    }
18    function postConnect() { $this->Lexer->addExitPattern('\$','plugin_latex_dollar'); }
19
20   /**
21    * Handle the match
22    */
23    function handle($match, $state, $pos, Doku_Handler $handler){
24	  if($state != DOKU_LEXER_UNMATCHED)
25		return array($match,$state,NULL);
26	  return array("$".$match."$",$state,'class'=>"latex_inline", 'title'=>"Math", NULL);
27    }
28 }
29