On Fri, Feb 14, 2014 at 1:08 PM, Ram Rachum <r...@rachum.com> wrote: > Thanks! > > But empty and the various forloop don't concern me because they're {{ }} > rather than {% %}, they don't start a block. > > Anything else? >
If you are truly interested, look at the source for django/template/defaulttags.py. Start by looking at calls to parser.parse(..), eg for the ifequal tag: def do_ifequal(parser, token, negate): bits = list(token.split_contents()) if len(bits) != 3: raise TemplateSyntaxError("%r takes two arguments" % bits[0]) end_tag = 'end' + bits[0] nodelist_true = parser.parse(('else', end_tag)) token = parser.next_token() if token.contents == 'else': nodelist_false = parser.parse((end_tag,)) parser.delete_first_token() else: nodelist_false = NodeList() val1 = parser.compile_filter(bits[1]) val2 = parser.compile_filter(bits[2]) return IfEqualNode(val1, val2, nodelist_true, nodelist_false, negate) This, plus some investigation, should give you what you want. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1KgdA4Wp83%3D4Ypud%2BGqNbULEMk6_1BHzYkAVs46EwTe9A%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.