1<?php 2/** 3 * Mediasyntax Plugin, preformatted block component: Mediawiki style preformatted text 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Esther Brunner <wikidesign@gmail.com> 7 */ 8class syntax_plugin_mediasyntax_preblock extends DokuWiki_Syntax_Plugin 9{ 10 11 function getType(){ return 'protected'; } 12 function getPType(){ return 'block'; } 13 function getSort(){ return 101; } 14 15 function connectTo($mode) 16 { 17 $this->Lexer->addEntryPattern( 18 '<pre>', 19 $mode, 20 'plugin_mediasyntax_preblock' 21 ); 22 } 23 24 function postConnect() 25 { 26 $this->Lexer->addExitPattern( 27 '</pre>', 28 'plugin_mediasyntax_preblock' 29 ); 30 } 31 32 function handle($match, $state, $pos, Doku_Handler $handler) 33 // This first gets called with $state=1 and $match is the entryPattern that matched. 34 // Then it (the function handle) gets called with $state=3 and $match is the text 35 // between the entryPattern and the exitPattern. 36 // Then it gets called with $state=4 and $match is the exitPattern. 37 // What this delivers is what is handed over as $data to the function render. 38 { 39 if ($state == DOKU_LEXER_UNMATCHED) 40 { 41 $handler->addCall('preformatted', array($match), $pos); 42 } 43 return true; 44 } 45 46 function render($mode, Doku_Renderer $renderer, $data) 47 { 48 return true; 49 } 50} 51 52//Setup VIM: ex: et ts=4 enc=utf-8 : 53