Saturday, July 28, 2007

Example is the Curl developer's example macro


This little Curl script could be the web developer's best friend.
As a web content language, Curl 5.0 provides a powerful RIA platform. This applet using the macro 'example' might convince you.
The macro 'example' creates a live code example in your browser which will open a child applet window.
First we run the following code snippet as an applet in the Curl IDE, embed it as a web applet or launch it with the Curl RTE with a dbl-click in a file explorer.
{curl 5.0 applet}
{applet license="development"}
{curl-file-attributes character-encoding = "windows-latin-1"}
{import * from CURL.DOC.CONTENT.ACCESSORIES}
{example 
{bold Hello {italic there}! }
}

Example is a Curl macro. The result is a web page in which to execute Curl, revert and save Curl applets. It you know something slicker than this, I would want to see it.
You may notice that in my example I have thrown in a {VBox }
I could hit REVERT and I would be back at the original. Here is the result:



If I like my changes, I can save the code from the web page with 'Save Applet'.
In practical terms this also means the ability to create web-based developer documentation with 'live' code snippets. And the eample maco nests: you can have a nippet which is used to demonstrate another snippet.
Curl comes with a visual test framework, but this little 'example' macro should give you a hint of what is possible in Curl 5.0
Note that 'example' is made available by importing the Curl package
CURL.DOC.CONTENT.ACCESSORIES

No comments: