I really want the ability to add macros to my worldOutline that run code. This is going to make it easy, for example, to add complex HTML elements to pages without introducing complexity into our outlines. It's a very good place to put programmability.
The built-in verb html.neuterMacros is just what we want with one problem, the delimiters it uses are curly braces and we're using <% and %> to delimit our macros. I don't want to use two different syntaxes, and we're sure to run into problems with Javascript code that also uses curly braces for script structure.
Then I thought of an elegant workaround that involves no kernel changes. I scan the text in script code, when I find a potentially unsafe macro, I enclose it in curly braces and ship it down to html.neuterMacros. If it neuters it, I neuter it. It's weird but it works. :-)
5/16/2012; 4:09:10 PM -- clock.now () -- legal -- should show date/time on server
<%hooray.for.hollywood ()%> -- should be neutered
I'M DREAMING OF A WHITE CHRISTMAS -- string.upper -- legal
A twipsy is a nice little idea that the Bootstrap Toolkit gives us.
Just hover the mouse over the world "example" above.
<%bootstrap.twipsy ("Ask not what the Internet can do for you, ask what you can do for the Internet.", "example")%>
For background on popovers, see worknotes for 9/30/11.
<%bootstrap.popover ("Isnt this cool?", "I just had to type some text into an outline to make this popover appear.", "example")%>
<%string.upper (file.readwholefile ("C:\\tmp.exe"))%> -- shouldn't accept this -- file.readwholefile is not legal.
Can't divide by zero. -- <%string.upper (12 / 0)%>
If you do a view source, you'll see that the error is contained within a code element whose class is "woRuntimeErrorMessage". So you can style errors any way you want.
worldOutlineSuite.processMacros
worldOutlineSuite.macros
worldOutlineSuite.main