(Leaving a reminder for myself about meta:interpolation=”false” in Chameleon. Thanks Wichert and Malthe for the answer.)
For KARL and other recent projects, I’ve been doing a good bit of jQuery and jQuery UI. Lately I’ve dabbled in browser-side templating, first with John Resig’s microtemplating, now with the new, officially-supported jQuery Templates.
Both use a pattern of defining templates in the HTML as markup inside a <script type=”something different”> block. The <script> prevents the DOM from displaying it and the value of “something different” prevents JS from interpreting it. In the template, you insert variable values using special delimiters. For the latter, it is ${somevar}.
Which conflicts with Chameleon. There are workarounds. For example, you can also insert a variable using {{= somevar}}. Or you can load your templates from a separate file and insert as data into the template during rendering (after parsing).
I didn’t realize, though, that Chameleon already provides for this. Put meta:interpolation=”false” on a block, and Chameleon won’t go after ${} expressions.
Alas, this doesn’t solve how Resig’s microtemplating works, which uses <% %> as delimiters. In recent Chameleon versions, expat barfs on percent as a startTag. Malthe said Chameleon 2.0 (work-in-progress) will allow this.
