[Tip] Colorize and format Servoy methods for HTML output
by David Workman
Data Mosaic
[image unavailable: 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 HTMLall 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.
Comments (1)