Rasoul Hajikhani wrote:
>
> Craig Barratt wrote:
> >
> > > I am using template toolkit to generate dynamic content. I have
> > > encoutered the following error:
> > >
> > > unexpected token ('<A)
> > > -- is_allowed_todo('<A HREF="/job?page=CrewEditPage&job=[% job
> > >
> > > I need a work around to this problem. Here is what I am doing:
> > >
> > > [% is_allowed_todo('<A HREF="/job?page=CrewEditPage&job=[% job
> > > %]&code=[% ref.first %]"><font face="sans-serif, Arial, Helvetica"
> > > size="2">[% ref.1 %]</FONT></A>','MOD','_default') %]
> > >
> > > I can't figure out where the missing token is. I am thinking that since
> > > I am using '' it should be safe to include [% %] any where. Right?
> >
> > No. The closing "%]" is detected by a simple regex before the parser
> > sees it, so it will be seen inside any single or double quotes. The
> > parser sees just:
> >
> > [% is_allowed_todo('<A HREF="/job?page=CrewEditPage&job=[% job %]
> >
> > and it is complaining about the unclosed quote.
> >
> > I assume you want to preserve the TT directives inside the string
> > and process them later as part of a two-step process? You have
>
> Actually, I want it to be interpreted and the appropriate tage e.g.: [%
> job %]
> be replaced with "hp" or "sum" or whatever the job might be.
>
> > several choices: change the START_TAG/END_TAG on the first or
> > second pass, use some other special tags inside the first argument
> > to is_allowed_todo() and have it replace them, or use a variable
> > for the end tag and interpolate it in the string using $endTag (you
> > will have to use double quotes instead of single), eg:
> >
> > endTag = "%\]";
> > is_allowed_todo("<A HREF='/job?page=CrewEditPage&job=[% job $endTag ....
> >
>
> hmmm. I will try this. It looks promising :)
It got rid of the error but it is not being interprated before being
passed to the
function. Any ideas?
thanks
-r
>
> > Craig
> >
> > _______________________________________________
> > templates mailing list
> > [EMAIL PROTECTED]
> > http://www.template-toolkit.org/mailman/listinfo/templates
>
> _______________________________________________
> templates mailing list
> [EMAIL PROTECTED]
> http://www.template-toolkit.org/mailman/listinfo/templates