summaryrefslogtreecommitdiff
path: root/inc/parserutils.php
diff options
context:
space:
mode:
authorandi <andi@splitbrain.org>2005-04-19 20:56:03 +0200
committerandi <andi@splitbrain.org>2005-04-19 20:56:03 +0200
commitac83b9d8ee0da2839787d268e28b1bfe3066c1b7 (patch)
tree02dd400d04987c77c699a20b2ddf7c56336afd3c /inc/parserutils.php
parent71352def8211fd38eafe887a9ccd0e5365b34962 (diff)
downloadrpg-ac83b9d8ee0da2839787d268e28b1bfe3066c1b7.tar.gz
rpg-ac83b9d8ee0da2839787d268e28b1bfe3066c1b7.tar.bz2
fixes for the export
darcs-hash:20050419185603-9977f-4bc9a1ba1878436bd71795c5d7fec2a5582561bf.gz
Diffstat (limited to 'inc/parserutils.php')
-rw-r--r--inc/parserutils.php18
1 files changed, 12 insertions, 6 deletions
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<!-- cachefile $cache used -->\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<!-- no cachefile used, but created -->\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 <hfuecks@gmail.com>
* @author Andreas Gohr <andi@splitbrain.org>
*/
-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();