Improved rendering of [php] tags in BBCode view

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@68873 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-12-14 23:57:07 +00:00
parent 4b2b3e3c5b
commit 10ee07db0d
2 changed files with 8 additions and 4 deletions

View File

@ -107,6 +107,10 @@ class BBCodeParser extends TextParser {
$this->content = str_replace(array('&', '<', '>'), array('&amp;', '&lt;', '&gt;'), $this->content);
$this->content = SSHTMLBBCodeParser::staticQparse($this->content);
$this->content = "<p>".$this->content."</p>";
$this->content = preg_replace('/(<p[^>]*>)\s+/i', '\\1', $this->content);
$this->content = preg_replace('/\s+(<\/p[^>]*>)/i', '\\1', $this->content);
$this->content = preg_replace("/\n\s*\n/", "</p><p>", $this->content);
$this->content = str_replace("\n", "<br />", $this->content);
return $this->content;

View File

@ -65,12 +65,12 @@ class SSHTMLBBCodeParser_Filter_Extended extends SSHTMLBBCodeParser_Filter
'htmlclose' => 'q',
'allowed' => 'all',
'attributes'=> array('quote' =>'cite=%2$s%1$s%2$s')),
'code' => array('htmlopen' => 'div class="codesnippet"',
'htmlclose' => 'div',
'code' => array('htmlopen' => 'div class="codesnippet"><p',
'htmlclose' => 'p></div',
'allowed' => 'all',
'attributes' => array()),
'php' => array('htmlopen' => 'div class="codesnippet"',
'htmlclose' => 'div',
'php' => array('htmlopen' => 'div class="codesnippet"><p',
'htmlclose' => 'p></div',
'allowed' => 'all',
'attributes' => array()),
'h1' => array('htmlopen' => 'h1',