At project level is impossible, because you don't know for sure which
templates belong to which project. But it should be possible to define
the markup syntax for a directory of templates.

Embedded in the template is tricky, that's a chicken and egg problem.
The language should be known, before we are able to parse this kind of
meta information. We can also of course assume that we have the
current syntax at the beginning, and have a template_tag like the
following, which alters the lexer at that point.

{% template_syntax "[%" "]%" %}

But while it is possible and has it's uses, I'm really sure that there
are enough people against a dynamic syntax. It is too easy for the end-
users to screw this up, and abuse it...
I think a verbatim/raw/cdata -like tag is sufficient.


By the way, the syntax is defined in:  django.template.base.
{BLOCK_TAG_START,BLOCK_TAG_END,...}


On 27 mai, 09:07, Michael Blume <blume.m...@gmail.com> wrote:
> Would it be possible to customize the markup Django uses for template
> compilation, either at the project level, at compile-time, or embedded in
> the template itself?
>
> -Mike
>
> On Thu, May 26, 2011 at 11:59 PM, Jonathan Slenders <
>
>
>
>
>
>
>
> jonathan.slend...@gmail.com> wrote:
> > +1 for the verbatim tag. I think this is something that we need in
> > Django by default.
>
> > But I think that ericflo his implementation is not truly verbatim. I
> > mean, that it will probably drop whitespace between "{%" and the tag
> > names. It may not be important for jQuery, but if we implement
> > verbatim, the output should be an exact copy of the verbatim contents.
>
> > Further, because it is possible that other languages use the same {%
> > verbatim %} syntax, we should be able to configure what the end-tag
> > looks like. That way, we can nest {% verbatim %} tags.
>
> > For instance:
> > {% verbatim "===" %}
> >      ...
> > {% "===" %}
>
> > Cheers,
> > Jonathan
>
> > On 27 mai, 07:04, Sean O'Connor <s...@seanoc.com> wrote:
> > > I think it would be a bit much for us to ask the jQuery crew to change
> > their template language to avoid conflict with ours. Aside from the amount
> > of backwards incompatible work we'd be asking them to do, they'd probably
> > just end up with a new conflict with some other template language. At the
> > end of the day this is also more of a symptom than an underlying problem.
> > Even if we got the jQuery crew to change their syntax, there would still be
> > other JS template languages with the same conflict (e.g. mustache.js).
>
> > > A better approach would for Django to provide some tools and
> > documentation to help people work around the conflict. One easy solution
> > would be to provide a verbatim tag like what ericflo wrote athttps://
> > gist.github.com/629508. Another would be to provide documentation on tools
> > that make it easy to load jquery style templates via ajax like icanhaz.js.
>
> > > My vote is that we fix the problem once and for all on our end by
> > providing compatibility tools and guidance instead of trying to tell the
> > entire JS community to not conflict with out template syntax :)
>
> > > --
> > > Sean O'Connorhttp://www.seanoc.com
>
> > > On Thursday, May 26, 2011 at 11:14 PM, Ori Livneh 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 (mailto:
> > django-developers@googlegroups.com).
> > > > To unsubscribe from this group, send email to
> > django-developers+unsubscr...@googlegroups.com (mailto:
> > django-developers+unsubscr...@googlegroups.com).
> > > > For more options, visit this group athttp://
> > groups.google.com/group/django-developers?hl=en.
>
> > --
> > 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.

-- 
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.

Reply via email to