[[PageOutline(2-5,Contents,pullout)]]
= Render Genshi templates directly in wiki pages
{{{#!box warn
**Notice:** This plugin is deprecated in Trac 1.3.2 and later because Trac has switched from Genshi to Jinja2 as the template engine. The plugin will not function in Trac 1.5.1 and later.
This plugin has '''not''' been developed with security considerations in mind. '''Only enable this macro on sites where you trust *all* users who can edit *any* wiki text with the web server's account.'''
}}}
== Description
The GenshiMacro allows you to write and render Genshi templates directly in wiki pages with a new `Genshi` processor.
Your templates will have access to the request as `req`, which can be useful for tasks like URL generation, rendering form tokens for POST requests, and checking for a logged-in user.
'''Note: no security considerations whatsoever went into the making of this plugin. Remy Blank gave some advice:'''
Genshi templates allow executing arbitrary Python code. So you basically give users who can insert the macro anywhere (wiki page, ticket comment, etc) permission to act as the user running Trac, including running any shell command:
{{{
{{{#!Genshi
${open('/etc/apache2/htpasswd').read()}
}}}
}}}
{{{
{{{#!Genshi
}}}
}}}
So my advice is, only enable this macro on sites where you trust *all* users who can edit *any* wiki text with the web server's account.
== Bugs/Feature Requests
Existing bugs and feature requests for GenshiMacro are
[report:9?COMPONENT=GenshiMacro here].
If you have any issues, create a
[/newticket?component=GenshiMacro new ticket].
[[TicketQuery(component=GenshiMacro&group=type,format=progress)]]
== Download
Download the zipped source from [https://github.com/trac-hacks/trac-GenshiMacro/tags here].
== Source
You can clone GenshiMacro from [git://github.com/trac-hacks/trac-GenshiMacro.git here] using Git, or [https://github.com/trac-hacks/trac-GenshiMacro browse the source] with Github.
== Installation
To use the plugin, install it in your Trac environment and enable it in your `trac.ini` file:
{{{#!ini
[components]
genshimacro.* = enabled
}}}
You can then write Genshi templates directly in wiki pages.
== Example
{{{
{{{
#!Genshi
}}}
}}}
== Recent Changes
[[ChangeLog(genshimacro, 3)]]
== Author/Contributors
'''Author:''' [wiki:ejucovy] [[BR]]
'''Maintainer:''' [[Maintainer]] [[BR]]
'''Contributors:'''