Last update: Fri, Jan 27, 2012 at 11:48 AM.
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. :-)
-
<%clock.now ()%> -- clock.now () -- legal -- should show date/time on server
<%hooray.for.hollywood ()%> -- should be neutered
<%string.upper ("I'm dreaming of a white christmas")%> -- string.upper -- legal
-
A twipsy is a nice little idea that the Bootstrap Toolkit gives us.
Here's an <%bootstrap.twipsy ("Ask not what the Internet can do for you, ask what you can do for the Internet.", "example")%> of one.
Just hover the mouse over the world "example" above.
-
-
-
-
-
<%string.upper (12 / 0)%> -- <%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.
-