Re: Proposal for a new templatetag definition syntax

2011-10-13 Thread Julien Phalip
On 13 October 2011 15:30, LeeS wrote: > Not sure if this is still an ongoing discussion, but I prefer to write > all new tags with a simple syntax that matches Python. There's no > real advantage in defining a unique, custom syntax for a template > tag. > > All HTML authors

Re: Proposal for a new templatetag definition syntax

2011-10-13 Thread LeeS
Not sure if this is still an ongoing discussion, but I prefer to write all new tags with a simple syntax that matches Python. There's no real advantage in defining a unique, custom syntax for a template tag. All HTML authors are already familiar with Python's kwargs syntax, since it exactly

Re: Proposal for a new templatetag definition syntax

2011-09-12 Thread Donald Stufft
I'll +1 the restriction of template tags to being arg/kwarg like. I see no reason, other then porting already written tags, to worry about the ability to do ``{% mytag foo as bar %}``. Personally I would think it would be desirable to make this match python as much as possible. Python

Re: Proposal for a new templatetag definition syntax

2011-09-12 Thread Jannis Leidel
Hi all, > For many years, writing templatetags has been among the most hilariously > complicated things we Django developers did. Anyone who has written parsing > for > templatetags, over and over, shares this pain. Further, the current syntax > present a tremendous problem for Armin Ronacher's

Re: Proposal for a new templatetag definition syntax

2011-09-12 Thread Jonas H.
On 09/12/2011 11:49 AM, Cal Leeming [Simplicity Media Ltd] wrote: I may have misunderstood this thread slightly but, should templatetags follow the same structure as *args, **kwargs?? i.e. *args {% create_title "hello world" 800 800 %} **kwargs {% create_title title="helloworld" width=800

Re: Proposal for a new templatetag definition syntax

2011-09-12 Thread Cal Leeming [Simplicity Media Ltd]
I may have misunderstood this thread slightly but, should templatetags follow the same structure as *args, **kwargs?? i.e. *args {% create_title "hello world" 800 800 %} **kwargs {% create_title title="helloworld" width=800 height=800 %} mixture {% create_title "helloworld" width=800

Re: Proposal for a new templatetag definition syntax

2011-09-12 Thread Jonas H.
On 09/12/2011 10:47 AM, lucky wrote: Hello, Alex, I agree with Wim Feijen. The ability to implement a arbitrary syntax for tag parameters is too abstract problem and this causes an increase in the complexity of the solution. Tag delelopers are forced to define a grammar and deal with lexing and

Re: Proposal for a new templatetag definition syntax

2011-09-12 Thread lucky
Hello, Alex, I agree with Wim Feijen. The ability to implement a arbitrary syntax for tag parameters is too abstract problem and this causes an increase in the complexity of the solution. Tag delelopers are forced to define a grammar and deal with lexing and parsing. End users must to learn and

Re: Proposal for a new templatetag definition syntax

2011-09-12 Thread Anssi Kääriäinen
On Sep 11, 10:36 pm, Mikhail Korobov wrote: > I gave up defining this template tag with existing template tag libraries: > > {% easy_map [ ] [] [using ] %} > > Can positional arguments be optional? Will it be possible to express this > syntax? >From the department of

Re: Proposal for a new templatetag definition syntax

2011-09-11 Thread Mikhail Korobov
I gave up defining this template tag with existing template tag libraries: {% easy_map [ ] [] [using ] %} Can positional arguments be optional? Will it be possible to express this syntax? -- You received this message because you are subscribed to the Google Groups "Django developers"

Re: Proposal for a new templatetag definition syntax

2011-09-10 Thread Alex Gaynor
On Fri, Sep 9, 2011 at 6:16 PM, Wim Feijen wrote: > Hi Alex, > > Probably I am thinking way too simple, but if you gave me a free > choice of how to write templatetags in my code, I would prefer: > > def mytag(foo, bar): > # some code > return output > > or: > >

Re: Proposal for a new templatetag definition syntax

2011-09-09 Thread Wim Feijen
Hi Alex, Probably I am thinking way too simple, but if you gave me a free choice of how to write templatetags in my code, I would prefer: def mytag(foo, bar): # some code return output or: class MyTag(Tag): def __init__(self, foo, bar): self.foo = foo self.bar =

Proposal for a new templatetag definition syntax

2011-09-09 Thread Alex Gaynor
Hello all, For many years, writing templatetags has been among the most hilariously complicated things we Django developers did. Anyone who has written parsing for templatetags, over and over, shares this pain. Further, the current syntax present a tremendous problem for Armin Ronacher's GSOC