Topic: BBCodeize and h()

I am in the process of implementing the BBCodeizer plugin and have noticed a little bug that I can't quite seem to fix.

The plugin allows for quotes with citations as follows (I put a space after all opening brackets to make the actual bbcode show up here):

[ quote="Albert Einstein"]e=mc^2[ /quote]

The plugin recommends using the bbcodeize function with the h function to clean out the text first:


This however breaks the quote with citation tag because all quotation marks get converted to their html equivalent before getting converted to bbcode.

The quote with citation tag is defined as follows:

:start_quote_with_cite => [ /\

"(.*?)"\ wrote:

                  '<blockquote><cite>\1 wrote:</cite><br />' ]

I tried simply changing the quotation marks to their html equivalent but it didn't seem to help. How might I modify this expression to identify bbcode that has already been passed through the h() function?

Last edited by jfredrickson (2008-09-30 12:07:23)

Re: BBCodeize and h()

Decided to just do a gsub on the h() function to change the modified quotation marks back before sending the string to the bbcodeize function:


&quot;(.*?)&quot;\ wrote:

/i, '

\1 wrote:


Seems to work so far and it doesn't modify the plugin at all so it shouldn't affect any future updates that may fix this bug.