1<?php 2 3require_once(realpath(dirname(__FILE__).'/../latexinc.php')); 4 5class syntax_plugin_latex_latex extends syntax_plugin_latex_common { 6 /** 7 * return some info 8 */ 9 function getInfo(){ 10 $a = parent::getInfo(); 11 $a['name'] = '<latex>...</latex> syntax for inline LaTeX (non-math-mode)'; 12 return $a; 13 } 14 15 // Sort in at high priority. 16 function getSort(){ 17 return 100; 18 } 19 20 /** 21 * Connect pattern to lexer 22 */ 23 function connectTo($mode) { 24 $this->Lexer->addEntryPattern('\x3Clatex\x3E(?=.*\x3C/latex\x3E)',$mode,'plugin_latex_latex'); 25 } 26 27 function postConnect() { 28 $this->Lexer->addExitPattern('\x3C/latex\x3E','plugin_latex_latex'); 29 } 30 31 /** 32 * Handle the match 33 */ 34 function handle($match, $state, $pos, &$handler){ 35 if($state != DOKU_LEXER_UNMATCHED) 36 return array($match,$state,NULL); 37 return array($match,$state,'class'=>"latex_inline", 'title'=>"LaTeX", NULL); 38 } 39 } 40 41 42