From 5f70445d51e06ae1a3d1bf820f97238942985fde Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 3 Mar 2007 22:41:02 +0100 Subject: added getFormat() function to renderer Each renderer has to supply a getFormat() function returning the format it produces. Usually this is the same as the classname of the renderer (or Plugin) says but it does not need to be necessarily. Fixes a problem with the wrong format being reported to plugins when a render plugin was used. darcs-hash:20070303214102-7ad00-3f87d8a10e94f4c6c30bacc8f43486b94ecdb146.gz --- inc/parser/renderer.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'inc/parser/renderer.php') diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 0e6fa2d85..1b6340445 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -37,13 +37,21 @@ class Doku_Renderer extends DokuWiki_Plugin { $this->info['toc'] = false; } + /** + * Returns the format produced by this renderer. + * + * Has to be overidden by decendend classes + */ + function getFormat(){ + trigger_error('getFormat() not implemented in '.get_class($this), E_USER_WARNING); + } + + //handle plugin rendering function plugin($name,$data){ $plugin =& plugin_load('syntax',$name); if($plugin != null){ - // determine mode from renderer class name - format = "Doku_Renderer_" - $mode = substr(get_class($this), 14); - $plugin->render($mode,$this,$data); + $plugin->render($this->getFormat(),$this,$data); } } -- cgit v1.2.3