diff --git a/parsers/BBCodeParser.php b/parsers/BBCodeParser.php index 221c0d165..a11058bfc 100644 --- a/parsers/BBCodeParser.php +++ b/parsers/BBCodeParser.php @@ -106,9 +106,10 @@ class BBCodeParser extends TextParser { function parse() { $this->content = str_replace(array('&', '<', '>'), array('&', '<', '>'), $this->content); $this->content = SSHTMLBBCodeParser::staticQparse($this->content); + Debug::message($this->content); $this->content = "

".$this->content."

"; - $this->content = str_replace("\n\n", "

", $this->content); - $this->content = str_replace("\n", "
", $this->content); + $this->content = preg_replace("/([^>\s]\s*)\n\n/", '$1

', $this->content); + $this->content = preg_replace("/([^>\s]\s*)\n/", '$1
', $this->content); return $this->content; } diff --git a/parsers/HTML/BBCodeParser/Filter/Extended.php b/parsers/HTML/BBCodeParser/Filter/Extended.php index 67786bf84..2c5749c22 100644 --- a/parsers/HTML/BBCodeParser/Filter/Extended.php +++ b/parsers/HTML/BBCodeParser/Filter/Extended.php @@ -65,10 +65,14 @@ class SSHTMLBBCodeParser_Filter_Extended extends SSHTMLBBCodeParser_Filter 'htmlclose' => 'q', 'allowed' => 'all', 'attributes'=> array('quote' =>'cite=%2$s%1$s%2$s')), - 'code' => array('htmlopen' => 'pre', - 'htmlclose' => 'pre', + 'code' => array('htmlopen' => 'div class="codesnippet"', + 'htmlclose' => 'div', 'allowed' => 'all', - 'attributes'=> array()), + 'attributes' => array()), + 'php' => array('htmlopen' => 'div class="codesnippet"', + 'htmlclose' => 'div', + 'allowed' => 'all', + 'attributes' => array()), 'h1' => array('htmlopen' => 'h1', 'htmlclose' => 'h1', 'allowed' => 'all', @@ -96,7 +100,9 @@ class SSHTMLBBCodeParser_Filter_Extended extends SSHTMLBBCodeParser_Filter ); - + function _preparse() { + $this->_preparsed = str_replace("\t", "   ", $this->_text); + } } ?> \ No newline at end of file