1<?php 2// must be run within Dokuwiki 3if(!defined('DOKU_INC')) die(); 4 5/** 6 * All DokuWiki plugins to extend the parser/rendering mechanism 7 * need to inherit from this class 8 */ 9class syntax_plugin_subnumberlist extends DokuWiki_Syntax_Plugin { 10 11 public function getType(){ return 'container'; } 12 public function getAllowedTypes() { return array('container'); } 13 public function getSort(){ return 158; } 14 public function connectTo($mode) { 15 $this->Lexer->addEntryPattern('<subnumberlist>(?=.*?</subnumberlist>)',$mode,'plugin_subnumberlist'); 16 } 17 public function postConnect() { 18 $this->Lexer->addExitPattern('</subnumberlist>','plugin_subnumberlist'); 19 } 20 21 22 /** 23 * Handle the match 24 */ 25 public function handle($match, $state, $pos, Doku_Handler $handler){ 26 switch ($state) { 27 case DOKU_LEXER_ENTER: 28 return array($state, $match); 29 30 case DOKU_LEXER_UNMATCHED : 31 return array($state, $match); 32 33 case DOKU_LEXER_EXIT : 34 return array($state, ''); 35 36 } 37 return false; 38 } 39 40 41 public function render($mode, Doku_Renderer $renderer, $indata) { 42 if($mode == 'xhtml') { 43 list($state, $match) = $indata; 44 switch ($state) { 45 case DOKU_LEXER_ENTER : 46 $renderer->doc .= '<div class="subnumberlist">'; 47 break; 48 49 case DOKU_LEXER_UNMATCHED : 50 $renderer->doc .= $renderer->_xmlEntities($match); 51 break; 52 53 case DOKU_LEXER_EXIT : 54 $renderer->doc .= '</div>'; 55 break; 56 } 57 return true; 58 } 59 return false; 60 } 61} 62 63//Setup VIM: ex: et ts=4 enc=utf-8 : 64?> 65