Hi, I've using this in Django. I've just substituted {{ }} for [[ ]] in my jquery templates and created a list of all the template ids I have. Then, on document ready, I do:
for (var i in templates){ var newtext = $(templates[i]).text().replace(/\[\[/g, "{{").replace(/\]\]/g, "}}"); $(templates[i]).text(newtext); } That replaces the [[ ]] for {{ }} again on the client side, removing any conflict. Works perfectly :) On May 27, 4:14 am, Ori Livneh <ori.liv...@gmail.com> wrote: > Hello, > > jQuery.tmpl(), a beta feature slated for inclusion in the main jQuery > brach, uses some of the same syntax as Django in its templating > markup, which is a bit of a bummer. I'm writing to see whether you > think we should get in touch with the jQuery team to see if they could > plausibly change it. > > There are, obviously, quite a lot of templating languages out there, > and some of them are bound to clash with Django, and that's not a > problem. But Django and jQuery are often deployed together (jQuery is > actually bundled with Django for use in the admin), making this clash > especially annoying. > > You might think this isn't an issue since JavaScript code should be > served from static files anyway, but there's an added complication. > One of the patterns jQuery.tmpl() recommends is nesting templates > within a <script type="text/x-jquery-tmpl"> tag, relying on the fact > that <script> tags with unfamiliar type attributes are ignored by the > browser but are still accessible through the DOM. This makes jQuery > templates very convenient to embed in HTML. > > It's not a huge issue, obviously. The tags can be escaped, but the > resultant markup is pretty awful: > > {% open templatevariable %}if foo{% close templatevariable %} > bar > {% open templatevariable %}/if{% close templatevariable %} > > rather than > > {{if foo}} > bar{ > {/if} > > I personally would love it if jQuery adopted different syntax, and who > knows, the dev team might be amenable to it. It wouldn't be a huge > change for them. Is it worth asking? What do you think? > > -- Ori > > References:http://api.jquery.com/jquery.tmpl/https://github.com/jquery/jquery-tmpl -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.