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