The Third Bear

Just Right.

Writing Genshi macros in Trac wiki pages

egj trac , opensource

(5/6/2012) UPDATE: Remy Blank has provided some security advice about GenshiMacro.  "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 run any shell command.  Only enable this macro on sites where you trust *all* users who can edit *any* wiki text with the web server's account."

I've released two new plugins on Trac Hacks and Github.  

GenshiMacro is a wiki macro that lets you write, and render, Genshi templates directly in wiki pages using a ``#!Genshi`` processor for blockquotes.  These templates have access to the current request, which means you can check the user's authentication status, generate links using ``req.href``, and render form tokens for POST requests.  The plugin's Trac Hacks page includes a complete example of how you might use it to render a custom "New Ticket" form on a wiki page.

LighterTheme is a theme plugin that skins Trac, slightly, for a "lighter" look-and-feel.  It provides a narrower (940px) main content div; fewer dark lines in the top (mainnav and metanav) banner; bigger buttons (using CSS from Twitter Bootstrap); rounded corners on input fields; and the "Ubuntu" font used on Launchpad.  Here are some screenshots:

Trac LighterTheme timeline
Trac LighterTheme ticket
Trac LighterTheme reports