1<?php 2/** 3 * Creole Plugin, preformatted block component: Creole style preformatted text 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Esther Brunner <wikidesign@gmail.com> 7 */ 8 9/** 10 * All DokuWiki plugins to extend the parser/rendering mechanism 11 * need to inherit from this class 12 */ 13class syntax_plugin_creole_preblock extends DokuWiki_Syntax_Plugin { 14 15 function getType() { return 'protected'; } 16 function getPType() { return 'block'; } 17 function getSort() { return 101; } 18 19 function connectTo($mode) { 20 $this->Lexer->addEntryPattern( 21 '\n\{\{\{\n(?=.*?\n\}\}\}\n)', 22 $mode, 23 'plugin_creole_preblock' 24 ); 25 } 26 27 function postConnect() { 28 $this->Lexer->addExitPattern( 29 '\n\}\}\}\n', 30 'plugin_creole_preblock' 31 ); 32 } 33 34 function handle($match, $state, $pos, Doku_Handler $handler) { 35 if ($state == DOKU_LEXER_UNMATCHED) { 36 $handler->addCall('preformatted', array($match), $pos); 37 } 38 return true; 39 } 40 41 function render($mode, Doku_Renderer $renderer, $data) { 42 return true; 43 } 44} 45// vim:ts=4:sw=4:et:enc=utf-8: 46