From 5d568b990e8fc3c849ba1d694019eae8e42763e4 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 29 Mar 2008 20:44:43 +0100 Subject: Fix for FS#1350 Inline modes, and , when their associated config setting is off, will generate highlighted text wrapped in a element. There is a slight change in behaviour for p_xhtml_cached_geshi(), it will now strip leading and trailing blank lines from the input code string. Also fixes an issue where global $conf wasn't declared, preventing the ['target']['extern'] setting being passed to GeSHi darcs-hash:20080329194443-f07c6-00db3d502b07a6ff0c7f6e5c74a3691438504bcb.gz --- inc/parser/xhtml.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'inc/parser') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index b45e310ca..4476cbe3b 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -304,9 +304,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Execute PHP code if allowed * + * @param string $wrapper html element to wrap result if $conf['phpok'] is okff + * * @author Andreas Gohr */ - function php($text) { + function php($text, $wrapper='code') { global $conf; if($conf['phpok']){ @@ -315,31 +317,33 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= ob_get_contents(); ob_end_clean(); } else { - $this->code($text, 'php'); + $this->doc .= p_xhtml_cached_geshi($text, 'php', $wrapper); } } function phpblock($text) { - $this->php($text); + $this->php($text, 'pre'); } /** * Insert HTML if allowed * + * @param string $wrapper html element to wrap result if $conf['htmlok'] is okff + * * @author Andreas Gohr */ - function html($text) { + function html($text, $wrapper='code') { global $conf; if($conf['htmlok']){ $this->doc .= $text; } else { - $this->code($text, 'html4strict'); + $this->doc .= p_xhtml_cached_geshi($text, 'html4strict', $wrapper); } } function htmlblock($text) { - $this->html($text); + $this->html($text, 'pre'); } function preformatted($text) { @@ -371,9 +375,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if ( is_null($language) ) { $this->preformatted($text); } else { - //strip leading and trailing blank line - $text = preg_replace('/^\s*?\n/','',$text); - $text = preg_replace('/\s*?\n$/','',$text); $this->doc .= p_xhtml_cached_geshi($text, $language); } } -- cgit v1.2.3