velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "shawn mcdermott" <>
Subject Re: BBCode Parser
Date Thu, 20 Apr 2006 16:52:04 GMT
On 4/14/06, Dominik Bruhn <> wrote:
> Hy,
> I know its not a velocity-specific question, but perhaps someone knows a
> solution.
> Perhaps you know BBCode: These is a Markup-Language used in
> Web-Bulletin-Boards like PHPBB or VBulletin. BB-Codes makes it possible to
> format the text by the user in easy ways while perserving the security for
> the administrators (no JavaScript, no IFrames, only permitted Tags). For
> example you get the String "[b]This is Bold [i] and this is italic and
> bold[/i][/b]". Now I need a piece of java which converts these Strings
> into
> HTML again, in case of this example to a string like "<b>This is Bold <i>
> and
> this is italic </i></b>". There are some difficult tags like
> [url=""]Search Engine[/url] which should be converted to
> "<a
> href="" target="_blank">Search Engine</a>".
> I know you could realize this easily by using Regular-Expressions, but
> this is
> not enough: You have to check that every tag opened is closed again,
> otherwise you get ugly HTML or the User is able to format more than his
> code
> because there is no closing Tag.
> I know the solution for these problems is to split up the string into a
> tree,
> then check it and merge the tree to the output-string again. Thats how the
> mentioned PHP-Boards do it. I could now realize this code in Java which
> costs
> me many time. Thats why I ask here: Is there someone who knows a
> BBCode-Parser written in Java?
> Thanks
> TO


it is part of the jboss project.  may help.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message