Here is some code from the {stringify } docs in Curl using the {example } macro
{value
let str:String =
{stringify
{define-proc public {foo}:void
{output "hi"} || a comment
}
}
{pre {value str}}
}
The equivalent in the {example } macro or within an applet is
{let str:String =
{stringify
{define-proc public {foo}:void
{output "hi"} || a comment
}
}
}
{pre {value str}}
which I find strikes many first time users as not obvious.
Where {value } is required is in cases such as within an applet
{applet name="our value example"}
def str = "some text"
{Frame height=20pt, width=200pt,
{text {value str} and some more text}
}
to avoid the result without the embedded {value } expression which would be
str and some more text
so as to obtain the intended
some text and some more text
The remarkable thing about the Curl docs is that you can experiment with the code changes within the documentation example page, run the code, save the code or restore the original code (and even go into the applet manager and exit misbehaving code.)
Here is a snapshot: (we have clicked execute and the applet is running)
If you click on the image you will see the {example } macro has buttons for execute, revert, save and to close the popup (applet) {View }.
No comments:
Post a Comment