1<?php 2/** 3 * Mediasyntax Plugin, span component 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Esther Brunner <wikidesign@gmail.com> 7 */ 8class syntax_plugin_mediasyntax_span extends DokuWiki_Syntax_Plugin 9{ 10 11 function getType(){ return 'paragraphs'; } 12 // If I choose "protected", the span works perfect, but what's within 13 // <span> and </span> will not get dokuwiki-parsed. 14 // If I choose "substitution" it's the other way round. 15 16 function getSort(){ return 100; } 17 18 function connectTo($mode) 19 { 20 $this->Lexer->addSpecialPattern( 21 '</*span.*?>', // .*? means "zero, one or more occurrences of any character except newline, non-greedy 22 $mode, 23 'plugin_mediasyntax_span' 24 ); 25 } 26 27 function handle($match, $state, $pos, Doku_Handler $handler) 28 // This first gets called with $state=1 and $match is the entryPattern that matched. 29 // Then it (the function handle) gets called with $state=3 and $match is the text 30 // between the entryPattern and the exitPattern. 31 // Then it gets called with $state=4 and $match is the exitPattern. 32 // What this delivers is what is handed over as $data to the function render. 33 { 34 return array($match, $state, $pos); 35 } 36 37 function render($mode, Doku_Renderer $renderer, $data) 38 { 39 // $data is the return value of handle 40 // $data[0] is always $match 41 // $data[1] is always $state 42 // $data[3] is always $pos 43 if($mode == 'xhtml') 44 { 45 $renderer->doc .= "$data[0]"; 46 } 47 return false; 48 } 49} 50 51//Setup VIM: ex: et ts=4 enc=utf-8 : 52