Am 28.09.2015 um 11:24 schrieb yawniek:

i'm trying to render a template that should output a javascript tag with some dynamic content within
the js.

the solution i found so far was

| //<![CDATA[
| function foo(){
- foreach( stuff; stuffs )
	|= stuff
|	  }
| //]]>
| </script>

is there a better solution
and secondly rendering this template yields an empty newline in the beginning, can it be removed?

If the particular problem can be reasonably broken down to string
expressions, you could also use the script tag like this:

script.
	function foo() {
		!{stuffs.joiner("\n")}
	}

But apart from that, the above solution is currently the only one. After
a while, when the compatibility mode for script tags* will have been
removed, it can be improved a little bit:

script
	| function foo(){
	- foreach (stuff; stuffs)
		|= stuff
	| }

* Currently "script" without a dot at the end behaves the same as with
a dot.