Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

how do i fix this text BlogEntry formatting issue?


Reply

2 Posts   1205 Views

Avatar
iandouglas736

12 January 2008 at 7:37am (Last edited: 12 January 2008 7:39am), Community Member, 8 Posts

When building a blog entry, if i use the 'code' element (or others that I've added to the mix), any double carriage-return gets parsed into a closing paragraph tag and a new opening paragraph tag.

(i've had to replace the [ and ] marks and < and > tags but you'll see what I mean)

So doing something like:
{code}my first line of code

second line{/code}

This obviously causes XML errors, since the parsed content looks something like:

(pre)my first line of code(/p)(p)second line(/pre)

How would I 'fix' this, where the line feeds are all just interpreted as break tags instead of paragraph tags, only when in a 'code' element?

Avatar
iandouglas736

12 January 2008 at 7:45am Community Member, 8 Posts

Found it ... sapphire/parsers/BBCodeParser.php

Commented out this line around line 107 or so:

$this->content = str_replace("\n\n", "</p><p>", $this->content);