From d86d5af08a9eb7b1fa224fd98e1cc7b15032b634 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 13 Feb 2008 03:49:41 +0100 Subject: Rationalise Parser PHP & HTML syntax mode handling to renderer only. This patch corrects the problems with the previously (reversed) patch "remove htmlok and phpok tests from Doku_Handler". The handler will now write php, phpblock, html & htmlblock instructions and let the renderer decide how these instructions should be processed. The xhtml renderer will follow the "phpok" and "htmlok" config settings. If these settings are turned off the any instructions will be rendered as code with php or html syntax highlighting (as appropriate). darcs-hash:20080213024941-d26fc-ec485362803e63a2d949dad5c23e17db939e6ced.gz --- inc/parser/xhtml.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index f033f6082..5e322d839 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -305,10 +305,14 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @author Andreas Gohr */ function php($text) { - ob_start(); - eval($text); - $this->doc .= ob_get_contents(); - ob_end_clean(); + if($conf['phpok']){ + ob_start(); + eval($text); + $this->doc .= ob_get_contents(); + ob_end_clean(); + } else { + $this->code($text, 'php'); + } } function phpblock($text) { @@ -321,7 +325,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @author Andreas Gohr */ function html($text) { - $this->doc .= $text; + if($conf['htmlok']){ + $this->doc .= $text; + } else { + $this->code($text, 'html4strict'); + } } function htmlblock($text) { -- cgit v1.2.3