Hey guys, I'm porting a plugin to trac 1.4 (from 1.0) but I'm having some 
trouble with Jinja2 sintax.

I read on docs trac 1.4 still can use genshi templates, so I solved some 
code problems (related to trac changes) and tried to ran, but it not 
worked. Then I started to replace genshi for jinja2, but I don't know how 
to replace some syntax details. For example:


1. I'm doing some modification on ticket.html, so I have and .html file 
that extends ticket.html and use parent(super()) in head and body. But I 
need to insert some things in the middle of parent code. I need to do it 
using javascript/jquery or can I do something else using jinja2? (in genshi 
syntax, I'm doing a lot of modifications based on py:match)

2. If I have a syntax like this:

>             <tr py:if="can_create_at_least_one_referenced_type">
>                 <th class="col1">Associate New:</th>
>                 <td class="fullrow" colspan="3">
>                     <ul class="references" py:for="item in 
> create_referenced" 
>                         py:with="keys = item.get_option('copy'); 
>                                  copied_fields = dict(zip(map(str, keys), 
> [ticket[key] for key in keys]))">
>                         <li><a href="${href.newticket(type=item.dest_type, 
> src=ticket.id, **copied_fields)}">Create a new referenced 
> '${ticket.get_alias(item.dest_type)}'</a></li>
>                     </ul>
>                 </td>
>             </tr>
>
 and replace with this:

>             <tr>
>                 # if can_create_at_least_one_referenced_type:
>                 <th class="col1">Associate New:</th>
>                 <td class="fullrow" colspan="3">
>                     <ul class="references">
>                         # for item in create_referenced:
>                         # with
>                         # set keys = item.get_option('copy')
>                         
> # set copied_fields = dict(zip(map(str, keys), [ticket[key] for key in keys]))
>                             <li><a href=
> "${href.newticket(type=item.dest_type, src=ticket.id, **copied_fields)}">
> Create a new referenced '${ticket.get_alias(item.dest_type)}'</a></li>
>                         # endwith
>                         # endfor
>                     </ul>
>                 </td>
>                 # endif
>             </tr>
>
Red line return a error:

> # set copied_fields = dict(zip(map(str, keys), [ticket[key] for key in 
> keys]))
> TemplateSyntaxError: expected token ',', got 'for'
>
Seems it not recognizes full command and think for is a param. I tried some 
tricks, but nothing done.

3. How can I write special symbols like:
    #   set directions=[(ticket.get_incoming_dict(), 'Referenced by', '&amp;
larr;', True), (ticket.get_outgoing_dict(), 'References', '&amp;
rarr;', False)]
(left and right arrows)

4. How macro works? I have a file1.html extending ticket.html. The first 
one needs to include file2.html(macro) and call ${macro1(params...)} in 
file1.html, right? I already have a file3.html(macro too) and file2.html 
needs to include it and call ${macro2(params...)}. How can I correctly 
describe it in terms of code?


att,
Gabriel Alves

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/a37ddcbb-6c4e-46e3-abf9-7615c70059c2%40googlegroups.com.

Reply via email to