Archive for the ‘Hacks’ Category

Trac Hacks

Monday, August 13th, 2007

As we have mentioned in our previous technical articles, we are using Trac as our wiki, issue tracking and file content browsing (with SVN as backend). One of the great things about Trac is its extensibility and customizability. We have made a couple of extensions (wiki-macros) and couple of customizations(CS templates).

Disclaimer: Those are really poor man hacks done by someone who does not know Python or CS (the template engine used by Trac).

We have added the two following macros to embed the Alexa and Technorati respective charts.

Alexa macro

    Example:
    [[Alexa(youtube.com)]] will embed something like:

    Install: Put this Alexa.py file in your trac/wiki-macros directory.

Technorati macro

    Example
    [[Technorati(Adobe Flex)]] will embed something like:

    Install: Put this Technorati.py file it in your trac/wiki-macros directory.

Excel and Trac

The last one, is the ugliest of all. It is a work-around allowing Microsoft Excel to extract data from Trac content tables. Excel can extract data from regular HTML tables on almost any regular http web page. However, for some reason, Excel does not like the Trac layout and did not recognize the table content. So, the hacks just show the content without the surrounding if the request contains “action=min”. We used “action” because we did not know how to read the other parameter. Yes, this is ugly, but it works. If you know a better way, feel free to let us know. Here is the code to add i the wiki.cs file

  <?cs if wiki.action == "min" ?>
  <html>
  <body>
  <?cs var:wiki.page_html ?>
  </body>
  </html>
  <?cs else ?>
  ....the rest of the wiki.cs file ...

We hope this will be useful to some people. Always good to share the un-sharable!