« [Article] UI tricks: move, resize, hide, and show interface elements | Main | [News] Email list service updated »

July 04, 2006

[Tip] Colorize and format Servoy methods for HTML output

by David Workman
Data Mosaic

Picture_3_1 Ever attempt to make Servoy code look good on an HTML page? Not the easiest task to figure out. In the early days of Servoy Magazine I wrote a solution (using Servoy of course) that takes as its input a Servoy method and converts it to HTML—all indenting and colorizing in tact. Certainly not the most elegant coding work I've done but it does the job.

I copy the output and place within <p class="code">...</p> tags for placement on Servoy Magazine. Download and modify as needed to fit your own particular needs. Here's a sample output:

//open URL in browser
if(utils.stringPatternCount(company_url, 'http') > 0)
{
    //data includes HTTP - so just open it
    application.showURL(company_url)
}
else
{
    //data does not include HTTP - so add it
    application.showURL('http://' + company_url)
}

Later this week I'll post an alternate way of doing the same thing.

| Posted by David Workman on July 4, 2006 at 11:57 PM in Tips | Permalink

Comments

Thanks David! that I was needing. ;-)

Posted by: Harjo Kompagnie | Jul 5, 2006 2:57:09 AM

Post a comment