I don't know about the status of this project, but I found this when I was looking for an existing library that would allow users to enter simple 'wiki markup' instead of HTML for exactly this sort of scenario - where you want to give some limited control over the formatting of user-supplied text.

http://www.radeox.org

I haven't done much with it - but when I was investigating this I found it pretty easy to integrate in to a WebObjects application. I just wrote a java.text.Format subclass that used the Radeox API to format the wiki mark-up to HTML.

Here's my 'format' method (RenderContext and RenderEngine are Radeox classes):

public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
                
                RenderContext context = new BaseRenderContext();
                RenderEngine engine = new BaseRenderEngine();
                
                String formattedText = engine.render(obj.toString(), context);
                toAppendTo.append(formattedText);
                
                return (toAppendTo);
        }

I then used an instance of my custom java.text.Format as the 'formatter' for any WOStrings that were displaying the user-submitted wiki-markup.

I'd be interested to know if anyone else has taken this approach and can recommend any other wiki-markup-to-HTML libraries.

Cheers,

Jake

On 05/06/2008, at 1:44 PM, Lachlan Deck wrote:

On 05/06/2008, at 1:36 PM, Rams wrote:

On Jun 4, 2008, at 11:07 PM, Chuck Hill wrote:


On Jun 4, 2008, at 7:34 PM, Rams wrote:

Hi everyone,

Sorry if this is a really n00b question, but what do you use to parse input for html tags? Is there anything built in? I'm using WO 5.3.3 and Wonder.

Thanks!

What is it you want to do?

Chuck

Well, I have a WOText for user input that will be displayed once it is saved... think: typical weblog.

Ideally, I'd like to allow a handful of html elements so that my users can have line breaks, paragraphs, and not just a solid block of text. At the same time, I'd also like to allow class attributes so that certain elements can be styled for different uses... like a shell code div, or a paragraph with a drop cap at the beginning. Naturally, I want to strip out mismatched tags so they can't escape their own little area on the page, strip out scripts, and pretty much anything else that could be easily abused. Basically, whitelist a few things and strip out everything else :-)

You might want to look into using a Textile engine. Quite simple to use.

with regards,
--

Lachlan Deck

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jmacmullin%40mac.com

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to