Hello Peter,

Thanks for persisting ;-)

On 1/15/2017 9:21 PM, Peter Suter wrote:
> On 14.01.2017 23:22, Peter Suter wrote:
>> On 14.01.2017 20:40, Christian Boos wrote:
>>> Also, what would be great is if you (or anyone else for that matter)
>>> could try to convert some plugins templates to Jinja2. That way, you
>>> could tell me what is not clear in the migration guide, or simply still
>>> missing from it.
>> Everything seems to work now. Maybe I'll try another one later.
> Not quite everything. Apparently I need to add
> `${jmacros.form_token_input()}` to every <form method="post">.
> This is described here:
> https://trac.edgewall.org/wiki/TracDev/PortingFromGenshiToJinja#Producingthecorrectcontentdirectly
> 
> Shouldn't this be moved out of the `ITemplateStreamFilter` section?

Maybe yes, the connection with the `ITemplateStreamFilter` is only
indirect: both were taking benefit of Genshi stream filters.

> 
> (Also I forgot to change
> `from genshi.builder import tag, Markup`
> to
> `from trac.util.html import tag, Markup`
> since the former still works at the moment.)

Yes, the nice thing is that `from trac.util.html import tag, Markup`
works with all recent versions of Trac, so we can aggressively promote
this change!

> 
> Next I converted https://trac-hacks.org/wiki/CardsPlugin
> This plugin only has one simple template, but calls `render_template()`.
> According to
> https://trac.edgewall.org/wiki/TracDev/PortingFromGenshiToJinja#Generatingcontent
> 
>> When one wants to directly render a template, the Chrome component
> facilities can be used, as before:
>> {{{
>> return Chrome(self.env).render_template(
>>                req, 'query_results.html', data, None, fragment=True)
>> }}}
> But actually it seems for Jinja templates one must now change this to:
> {{{
> return Chrome(self.env).render_template(
>                 req, 'query_results.html', data, {'fragment': True})
> }}}
> no?

Right, forgot to update that one. The trac.web.chrome API changed
recently during the preparation for the merge.

> I also converted these three:
> https://trac-hacks.org/wiki/PullRequestsPlugin
> https://trac-hacks.org/wiki/MailArchivePlugin
> https://trac-hacks.org/wiki/TimeTrackingPlugin
> which needed also <xi:include />, # if, # with, # block head which are
> all covered nicely in your guide.
> I had to look up how admin panels should work (# block adminpanel, etc.)
> in another example template, but that seems OK.

I'll have a look and see if I can give some hints for some improvements.
One thing I've seen in the example you posted in your previous mail was
that you wrote plenty of `${x['key']}`. You can use the more compact
`${x.key}`, this will work as well
(http://jinja.pocoo.org/docs/2.9/templates/#variables).

Also, if some of your plugins are localized, you can now also play with
that part, I've finalized the l10n support just now.

See for the jinja2-trunk-r15341 branch:

 - [3dd429ae/cboos.git] (#12639): rework the l10n support for Jinja2

(https://trac.edgewall.org/changeset/3dd429ae/cboos.git)


And the proof of concept with a new branch for the SpamFilter:

 - [15351] (#12639) Apply basic Jinja2 compatibility patch.
 - [15352] SpamFilter (jinja2): add support for l10n with Jinja2
 - [15353] SpamFilter (jinja2): convert one template

(https://trac.edgewall.org/log/plugins/trunk/spam-filter-jinja2)


> A small CSS quirk: When the "wiki expander" is set to "narrow", the
> title underline of e.g. `[[TicketQuery?]]` strangely overlaps the content.

I'll check that, but yes, I'm probably not done with tweaking this.

> (BTW why are all the titles red now? I rather liked that red indicated
> "link".)

Well, just because the Trac logo is red, and we have red already for
links, so it mixes well ;-) But I'm open to changing that. I'll
experiment with a darker red.

-- Christian

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-dev+unsubscr...@googlegroups.com.
To post to this group, send email to trac-dev@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to