-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01.05.2014 17:10, David Vanleeuwen wrote:
> Also, is there a way to run a python script in genshi?

I do know at least of two:

Python code block/lines (as permitted by Genshi xmlns as I guess)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
  xmlns:xi="http://www.w3.org/2001/XInclude";
  xmlns:py="http://genshi.edgewall.org/";>
  <!--!
    Copyright (C) 2007-2011 Radek BartoĊˆ <black...@post.cz>

    This software is licensed as described in the file COPYING, which
    you should have received as part of this distribution.
  -->
  <xi:include href="discussion-macros.html"/>
  <xi:include href="layout.html"/>
  <head>
    <title>Forum List &ndash; Discussion</title>
  </head>
  <?python
    from trac.wiki.formatter import format_to_oneliner
    from trac.util.datefmt import format_datetime, pretty_timedelta
    from tracdiscussion.api import format_to_oneliner_no_links
  ?>

Python code snippet inside ${} (another Genshi XHTML template extension)

  <py:def function="display_group(group, forums)">
    <table class="listing">
      <thead>
        <tr py:if="group and group.id != 0">
          <th class="group" colspan="11">
            <div class="name">${format_to_oneliner(discussion.env,
context, group.name)}</div>
            <div
class="description">${format_to_oneliner(discussion.env, context,
group.description)}</div>
          </th>
        </tr>

Beware, that cited examples are not showing ideal code by no means, just
meant for illustration of the real-world use case.

Steffen Hoffmann
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlNi7Z8ACgkQ31DJeiZFuHdomwCfTq79KKM2ksOxHox0NT1gEReI
m4oAn0aBussl6zBtFrke0vV3nfEfCymZ
=s7V7
-----END PGP SIGNATURE-----

-- 
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 trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to