From ac83b9d8ee0da2839787d268e28b1bfe3066c1b7 Mon Sep 17 00:00:00 2001 From: andi Date: Tue, 19 Apr 2005 20:56:03 +0200 Subject: fixes for the export darcs-hash:20050419185603-9977f-4bc9a1ba1878436bd71795c5d7fec2a5582561bf.gz --- inc/parserutils.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'inc/parserutils.php') diff --git a/inc/parserutils.php b/inc/parserutils.php index f8bec37c1..4e38e0162 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -30,7 +30,7 @@ function p_wiki_xhtml($id, $rev='', $excuse=true){ if($rev){ if(@file_exists($file)){ - $ret = p_render_xhtml(p_get_instructions(io_readfile($file))); //no caching on old revisions + $ret = p_render('xhtml',p_get_instructions(io_readfile($file))); //no caching on old revisions }elseif($excuse){ $ret = p_locale_xhtml('norev'); } @@ -86,7 +86,7 @@ function p_cached_xhtml($file){ $parsed = io_readfile($cache); $parsed .= "\n\n"; }else{ - $parsed = p_render_xhtml(p_cached_instructions($file)); //try to use cached instructions + $parsed = p_render('xhtml', p_cached_instructions($file)); //try to use cached instructions io_saveFile($cache,$parsed); //save cachefile $parsed .= "\n\n"; @@ -208,17 +208,23 @@ function p_get_instructions($text){ } /** - * Renders a list of instruction to XHTML + * Renders a list of instruction to the specified output mode * * @author Harry Fuecks * @author Andreas Gohr */ -function p_render_xhtml($instructions){ +function p_render($mode,$instructions){ if(is_null($instructions)) return ''; // Create the renderer - require_once DOKU_INC . 'inc/parser/xhtml.php'; - $Renderer = & new Doku_Renderer_XHTML(); + if(!@file_exists(DOKU_INC."inc/parser/$mode.php")){ + msg("No renderer for $mode found",-1); + return null; + } + + require_once DOKU_INC."inc/parser/$mode.php"; + $rclass = "Doku_Renderer_$mode"; + $Renderer = & new $rclass(); #FIXME any way to check for class existance? $Renderer->smileys = getSmileys(); $Renderer->entities = getEntities(); -- cgit v1.2.3