<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Module: BBCode, Escaping Brackets (code included)</title>
        <description> I&amp;#039;ve made a minor mod to my bbcode.php file so that I can show tags as text in my posts (so I can explain to people how to write them without them being all screwed up), added in this line:


// [DRK] - escaped brakets should be display as brackets...
$body = preg_replace(&amp;quot;/\\\]/is&amp;quot;, &amp;quot;]&amp;quot;, $body);

$data[$message_id][&amp;quot;body&amp;quot;] = $body;

Now I can escape the right bracket and have the thing display as plain text,  not sure how the [ quote ] loop effects things, I guess we&amp;#039;ll see! Example of what I could write to explain how to bold some text


[b\]bold text[/b\] displays as bold text

(obviously it wont look right on this forum... hehe)</description>
        <link>https://www.phorum.org/support/read.php?20,129644,129644#msg-129644</link>
        <lastBuildDate>Wed, 16 Sep 2026 17:06:28 -0500</lastBuildDate>
        <generator>Phorum 6.0.4</generator>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129743#msg-129743</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129743#msg-129743</link>
            <description><![CDATA[ I have &quot;fixing bbcode at post time&quot; as an option that I want to build into the BBcode module. It&#039;s really easy from where the module is right now. The tokenizing return data can be turned back into a message with only a few lines of code. I guess that with this kind of preparsing and fixing you could get the message body to a level where search-and-replace-style regular expressions could work to format the final message. But you got to be sure that you have any broken BBcode out of the way first. Either by fixing or by escaping the wrong BBcode.<br />
<br />
I looked into this direction for a little while, but after a lot of benchmarking and testing I came up with the current code. One extra thing that can be done with this code to make things faster, is cache the intermediate tokenized data. The tokenizing step is what consumes most time and caching that info would be really easy to do. This would provide more processing speed up than fixing the BBcode tags at post time. However, my findings were that the code is so fast already, that you probably would not notice any speed increases in building the page, unless you&#039;re running a really busy forum (and even then, other parts of the system would probably be the bottle neck here). Nonetheless, there&#039;s a big chance that I put it in the module at some point anyway, since to Phorum devs every microsecond counts.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Sat, 26 Apr 2008 21:33:17 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129742#msg-129742</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129742#msg-129742</link>
            <description><![CDATA[ Yeah, true on <i>all</i> points!<br />
<br />
With what you&#039;ve said about bad nesting (<b>[B][I]...[/B][/I]</b>), I think I may have to look into that a bit more, i&#039;m not sure that the situation has cropped up for me yet!<br />
<br />
Do you have a stance on <b>pre</b> parsing? That is, modifying the BBCode, <i>then</i> rendering the (X)HTML? Eg:<br />
<br />
A user types:<br />
<br />
<pre class="bbcode">here&#039;s [B]<i>some[/B] bad[/I] nesting</i></pre>
<br />
it is preparsed into:<br />
<br />
<pre class="bbcode">here&#039;s [I][B]some[/B] bad[/I] nesting</pre>
<br />
(so that if the user edits it again, (s)he will see the modified BBCode)<br />
then it is rendered into the usual (X)HTML:<br />
<br />
<pre class="bbcode">here&#039;s &lt;em&gt;&lt;strong&gt;some&lt;/strong&gt; bad&lt;/em&gt; nesting</pre>]]></description>
            <dc:creator>optimal</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Sat, 26 Apr 2008 19:35:32 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129739#msg-129739</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129739#msg-129739</link>
            <description><![CDATA[ Cool code, but it looks a lot like what we used to do with the previous BBcode module: use regular expressions to get things working. It worked well for a while, but it got us into trouble with wrongly nested tags and supporting nested tags like [quote] and [list]. It also doesn&#039;t help in fixing the (X)HTML that is produced, meaning that [b][i]....[/b][/i] would not be seen as [b][i]....[/i][/b]. Not a big problem for basic HTML, but it introduced troubles for the ones that run in very strict XHTML XML environments. That was the main reason for starting a new parser altogether.<br />
<br />
I see no problem in using &lt;br/&gt;&#039;s BTW. We use them too. Parsing a text in real paragraphs could be tedious. and could result in effects that the user does not suspect. The user adds breaks to the message body and the closest thing relating to that is a &lt;br/&gt; anyway.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Sat, 26 Apr 2008 18:59:36 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129735#msg-129735</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129735#msg-129735</link>
            <description><![CDATA[ Hey fella, totally forgot to send you my DCode (BBCode) parser last week like I said! Apparently I can&#039;t attach, so I&#039;ve uploaded a zip, and a demo on my dev site:<br />
<br />
[<a href="http://dev.oopstudios.com/dcode/" target="_blank"  rel="nofollow">dev.oopstudios.com</a>]<br />
[<a href="http://dev.oopstudios.com/dcode/index.php" target="_blank"  rel="nofollow">dev.oopstudios.com</a>]<br />
[<a href="http://dev.oopstudios.com/dcode/dcode.zip" target="_blank"  rel="nofollow">dev.oopstudios.com</a>]<br />
<br />
My method is pretty different to &quot;the normal&quot; technique as it creates paragraphing rather than lots of &lt;br /&gt;&#039;s, you can see this as a good thing or a bad thing depending on how you like your HTML!<br />
<br />
Hope you find it handy to some level!]]></description>
            <dc:creator>optimal</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Sat, 26 Apr 2008 12:31:08 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129701#msg-129701</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129701#msg-129701</link>
            <description><![CDATA[ For a company as small as the Netherlands, we have a lot of OSS coders around indeed!<br />
And I guess the Netherlands has the most Phorum coders per head of the population too ;-)<br />
<br />
@brianlmoon: insert random Dutch country size bashing quote here.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Wed, 23 Apr 2008 16:20:55 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129697#msg-129697</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129697#msg-129697</link>
            <description><![CDATA[ Dutch, that makes sense! You&#039;re in good company for coders, there&#039;s a lot of talent in the Netherlands like Van Rossum!! I hope you&#039;re having a good time in America, the MySQL conference looked good!<br />
<br />
When I get some spare time I&#039;ll definitely write a module or two for Phorum, I think the project is awesome in many ways, Kudos to you all!]]></description>
            <dc:creator>optimal</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Wed, 23 Apr 2008 16:09:33 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129695#msg-129695</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129695#msg-129695</link>
            <description><![CDATA[ brit as in British person? You&#039;re only a little bit off. I&#039;m a genuine Dutchman. The insomniac part is only a little bit off too. I can sleep, I just don&#039;t like it, so I tend to stay up late and code at weird hours. I think insomniac has to do with not being able to sleep. At the moment, I code at regular hours though though, since I&#039;m in the U.S., enjoying two weeks of vacation after the MySQL conference.<br />
<br />
I&#039;m glad you like the code. A lot of work was put into shaving and profiling the api.php file. That&#039;s where the meat of the whole thing is.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Wed, 23 Apr 2008 15:50:20 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129684#msg-129684</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129684#msg-129684</link>
            <description><![CDATA[ The coding looks awesome! I think I might give a similar module a go so that my forums have the same markup as my other sites. Should be interesting!<br />
<br />
<i>FYI: I&#039;m using Phorum as a support site for my other project, I dont want to confuddle my users with 2 different LML&#039;s!</i><br />
<br />
PS, you write like a brit... either you&#039;re an insomniac brit, or I am way off the mark! Hawhaw]]></description>
            <dc:creator>optimal</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Tue, 22 Apr 2008 14:52:21 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129668#msg-129668</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129668#msg-129668</link>
            <description><![CDATA[ Sure, please do so! If you want a peek at my latest BBcode parsing attempt, then download the <a href="http://www.phorum.org/phorum5/read.php?62,129667" target="_blank" >brand new BBcode module</a> that I just uploaded for testing.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Tue, 22 Apr 2008 02:04:33 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129662#msg-129662</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129662#msg-129662</link>
            <description><![CDATA[ No worries fella, sounds like you have it all under control!<br />
<br />
I&#039;ll whip you a PM when I&#039;m done with my new code anyway, just in case like!]]></description>
            <dc:creator>optimal</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Mon, 21 Apr 2008 21:42:08 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129658#msg-129658</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129658#msg-129658</link>
            <description><![CDATA[ I don&#039;t want to sound harsh, but no thanks ;-) The parser side is fully working and is pretty fast too. All that I&#039;m doing now, is integrating the parser with the bbcode module. You can send them as study material, but I&#039;m not sure if I&#039;d actually use something from your code. Thanks for the offer though.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Mon, 21 Apr 2008 19:49:09 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129655#msg-129655</guid>
            <title>Re: Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129655#msg-129655</link>
            <description><![CDATA[ Awesome work Maurice!<br />
<br />
I&#039;ve written a few variations on the theme of BBCode parsing from the ground up in previous side projects, if you want I can send them to you?? I&#039;m actually writing a fresh one (starting tomorrow) for a new ecommerce project with a javascript editor, should I keep you in the loop with my developments?]]></description>
            <dc:creator>optimal</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Mon, 21 Apr 2008 19:22:37 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129652#msg-129652</guid>
            <title>Re: BBCode Escaped Brackets</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129652#msg-129652</link>
            <description><![CDATA[ Yeah, still working on the new parser code, which is a real parser. In that parser, I&#039;m building in the option to be able to escape bbcode tags by prefixing them with a backslash, like \[code]. This then shows up as [code] instead. I&#039;m pretty far with the new code and looking at its progress, I think it might be in the next Phorum release already. If not, then we&#039;ll post a separate BBcode module package that you can try out.]]></description>
            <dc:creator>Maurice Makaay</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Mon, 21 Apr 2008 19:11:27 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129647#msg-129647</guid>
            <title>Re: BBCode Escaped Brackets</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129647#msg-129647</link>
            <description><![CDATA[ That&#039;s cool!<br />
<br />
Excuse my daft ramblings, I&#039;m new to phorum, so not really up to speed with the news, conferences and so forth! Loving it so far!]]></description>
            <dc:creator>optimal</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Mon, 21 Apr 2008 18:36:22 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129645#msg-129645</guid>
            <title>Re: BBCode Escaped Brackets</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129645#msg-129645</link>
            <description><![CDATA[ I think maurice and brian added a solution for that to the new bbcode parser written at the conference.]]></description>
            <dc:creator>Thomas Seifert</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Mon, 21 Apr 2008 17:20:01 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?20,129644,129644#msg-129644</guid>
            <title>Module: BBCode, Escaping Brackets (code included)</title>
            <link>https://www.phorum.org/support/read.php?20,129644,129644#msg-129644</link>
            <description><![CDATA[ I&#039;ve made a minor mod to my <b>bbcode.php</b> file so that I can show tags as text in my posts (so I can explain to people how to write them without them being all screwed up), added in this line:<br />
<br />
<pre class="bbcode">
// [DRK] - escaped brakets should be display as brackets...
$body = preg_replace(&quot;/\\\]/is&quot;, &quot;]&quot;, $body);

$data[$message_id][&quot;body&quot;] = $body;</pre>
<br />
Now I can escape the right bracket and have the thing display as plain text,  not sure how the [ quote ] loop effects things, I guess we&#039;ll see! Example of what I could write to explain how to bold some text<br />
<br />
<pre class="bbcode">
[b\]bold text[/b\] displays as <b>bold text</b></pre>
<br />
(obviously it wont look right on this forum... hehe)]]></description>
            <dc:creator>optimal</dc:creator>
            <category>Phorum Hack/Mod Requests</category>
            <pubDate>Mon, 21 Apr 2008 16:39:32 -0500</pubDate>
        </item>
    </channel>
</rss>
