In the compilation function of your template tag, you can force the  
parser to parse until tag named "endyourcustomtag" by calling nodelist  
= parser.parse(("endyourcustomtag", ). This will return the contents  
of your block tag as a list of nodes. Finally you can "drop off" the  
end tag by calling parser.delete_first_token() because parser.parse  
left the parser in a state where "endyourcustomtag" is still unparsed.

Find a find on "def do_if(parser, token):" -- check out how the if tag  
has been written.

Erik

On 19.10.2008, at 23:24, Siah wrote:

>
> Hi,
>
> I can't understand how template tags such as if, for and ifequal
> manage to have an accompanying endif, endfor and endifequal, and I
> can't have it. Or I can't manage to find out how to do it. So, I
> basically want to do something like:
>
> {% customTag %} hello {% endcustomTag %}
>
> and within my customTag implementation, have 'hello' as a parameter.
>
> Thanks for all the help in advance,
> Sia
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to