1<?php 2/** 3 * Creole Plugin, inline preformatted 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_preinline extends DokuWiki_Syntax_Plugin { 14 15 function getType() { return 'protected'; } 16 function getSort() { return 102; } 17 18 function connectTo($mode) { 19 $this->Lexer->addEntryPattern( 20 '\{\{\{(?=.*?\}\}\})', 21 $mode, 22 'plugin_creole_preinline' 23 ); 24 } 25 26 function postConnect() { 27 $this->Lexer->addExitPattern( 28 '\}\}\}', 29 'plugin_creole_preinline' 30 ); 31 } 32 33 function handle($match, $state, $pos, Doku_Handler $handler) { 34 switch ($state) { 35 case DOKU_LEXER_ENTER: 36 $handler->addCall('monospace_open', array(), $pos); 37 break; 38 case DOKU_LEXER_UNMATCHED: 39 $handler->addCall('unformatted', array($match), $pos); 40 break; 41 case DOKU_LEXER_EXIT: 42 $handler->addCall('monospace_close', array(), $pos); 43 break; 44 } 45 return true; 46 } 47 48 function render($mode, Doku_Renderer $renderer, $data) { 49 return true; 50 } 51} 52// vim:ts=4:sw=4:et:enc=utf-8: 53