diff options
author | Chris Smith <chris@jalakai.co.uk> | 2008-02-13 03:49:41 +0100 |
---|---|---|
committer | Chris Smith <chris@jalakai.co.uk> | 2008-02-13 03:49:41 +0100 |
commit | d86d5af08a9eb7b1fa224fd98e1cc7b15032b634 (patch) | |
tree | a3a2052bda93ec5a6fedc82662f7b4b2e5312fee /inc/parser | |
parent | 7adba38c3fe8ae35c4c79aa125b04d4427f13a72 (diff) | |
download | rpg-d86d5af08a9eb7b1fa224fd98e1cc7b15032b634.tar.gz rpg-d86d5af08a9eb7b1fa224fd98e1cc7b15032b634.tar.bz2 |
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
Diffstat (limited to 'inc/parser')
-rw-r--r-- | inc/parser/handler.php | 24 | ||||
-rw-r--r-- | inc/parser/xhtml.php | 18 |
2 files changed, 17 insertions, 25 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 740ccea04..ad2bb6056 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -268,11 +268,7 @@ class Doku_Handler { function php($match, $state, $pos) { global $conf; if ( $state == DOKU_LEXER_UNMATCHED ) { - if ($conf['phpok']) { - $this->_addCall('php',array($match), $pos); - } else { - $this->_addCall('file',array($match), $pos); - } + $this->_addCall('php',array($match), $pos); } return true; } @@ -280,11 +276,7 @@ class Doku_Handler { function phpblock($match, $state, $pos) { global $conf; if ( $state == DOKU_LEXER_UNMATCHED ) { - if ($conf['phpok']) { - $this->_addCall('phpblock',array($match), $pos); - } else { - $this->_addCall('file',array($match), $pos); - } + $this->_addCall('phpblock',array($match), $pos); } return true; } @@ -292,11 +284,7 @@ class Doku_Handler { function html($match, $state, $pos) { global $conf; if ( $state == DOKU_LEXER_UNMATCHED ) { - if($conf['htmlok']){ - $this->_addCall('html',array($match), $pos); - } else { - $this->_addCall('file',array($match), $pos); - } + $this->_addCall('html',array($match), $pos); } return true; } @@ -304,11 +292,7 @@ class Doku_Handler { function htmlblock($match, $state, $pos) { global $conf; if ( $state == DOKU_LEXER_UNMATCHED ) { - if($conf['htmlok']){ - $this->_addCall('htmlblock',array($match), $pos); - } else { - $this->_addCall('file',array($match), $pos); - } + $this->_addCall('htmlblock',array($match), $pos); } return true; } 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 <andi@splitbrain.org> */ 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 <andi@splitbrain.org> */ function html($text) { - $this->doc .= $text; + if($conf['htmlok']){ + $this->doc .= $text; + } else { + $this->code($text, 'html4strict'); + } } function htmlblock($text) { |