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?
(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.)
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?
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.
A small CSS quirk: When the "wiki expander" is set to "narrow", the
title underline of e.g. `[[TicketQuery?]]` strangely overlaps the content.
(BTW why are all the titles red now? I rather liked that red indicated
"link".)
Peter
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/d/optout.