I.e., instead of:
:!javascript
foo = #{safeJS(toJSON("foo"))}; // must remember to wrap everything
bar = #{"bar"}; // whoops!
scr = #{"</script>"}; // whoops!
can we do:
:&javascript
foo = #{"foo"};
bar = #{"bar"};
scr = #{"</script>"};
to get:
<script>
foo = "foo";
bar = "bar";
scr = "<\/script>";
</script>
instead of:
<script>
foo = "foo";
bar = "bar";
scr = "</script>";
</script>
--
Yang Zhang
http://yz.mit.edu/
You mean something like this?
https://github.com/scalate/scalate/blob/master/samples/scalate-sample/src/main/webapp/jade/jsFilter.jade
It generates
<script type='text/javascript'>
//<![CDATA[
foo = "foo";
bar = "bar;
//]]>
</script>
--
James
-------
FuseSource
Email: ja...@fusesource.com
Web: http://fusesource.com
Twitter: jstrachan, fusenews
Blog: http://macstrac.blogspot.com/
Open Source Integration and Messaging
Doesn't that also do HTML escaping? That doesn't work for JS
substitutions because then you get the latter output in my original
post instead of the former.
>
>
>
>
> --
> James
> -------
> FuseSource
> Email: ja...@fusesource.com
> Web: http://fusesource.com
> Twitter: jstrachan, fusenews
> Blog: http://macstrac.blogspot.com/
>
> Open Source Integration and Messaging
>
--
Yang Zhang
http://yz.mit.edu/