1<?php 2/** 3 * Syntax Plugin Prototype 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Andreas Gohr <andi@splitbrain.org> 7 */ 8 9if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); 10if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 11require_once(DOKU_INC.'inc/parser/parser.php'); 12 13/** 14 * All DokuWiki plugins to extend the parser/rendering mechanism 15 * need to inherit from this class 16 */ 17class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { 18 19 /** 20 * Needs to return one of the mode types defined in $PARSER_MODES in parser.php 21 */ 22 function getType(){ 23 trigger_error('getType() not implemented in '.get_class($this), E_USER_WARNING); 24 } 25 26 /** 27 * Handler to prepare matched data for the rendering process 28 * 29 * Usually you should only need the $match param. 30 * 31 * @param $match string The text matched by the patterns 32 * @param $state int The lexer state for the match 33 * @param $pos int The character position of the matched text 34 * @param $handler ref Reference to the Doku_Handler object 35 * @return array Return an array with all data you want to use in render 36 */ 37 function handle($match, $state, $pos, &$handler){ 38 trigger_error('handle() not implemented in '.get_class($this), E_USER_WARNING); 39 } 40 41 /** 42 * Handles the actual output creation. 43 * 44 * The function should always check for the given mode and return false 45 * when a mode isn't supported. 46 * 47 * $renderer contains a reference to the renderer object which is 48 * currently handling the rendering. You need to use it for writing 49 * the output. How this is done depends on the renderer used (specified 50 * by $mode 51 * 52 * The contents of the $data array depends on what the handler() function above 53 * created 54 * 55 * @param $mode string current Rendermode 56 * @param $renderer ref reference to the current renderer object 57 * @param $data array data created by handler() 58 * @return boolean rendered correctly? 59 */ 60 function render($mode, &$renderer, $data) { 61 trigger_error('render() not implemented in '.get_class($this), E_USER_WARNING); 62 } 63 64} 65 66//Setup VIM: ex: et ts=4 enc=utf-8 : 67