Include source Wiki Macro for trac

Posted by Yoshimasa Niwa on 12/16, 2006

This tiny plugin provides a migration with subversionized wiki source to wiki for trac, one of the most famous and powerful web based project manage and bug tracking system.

trac includes, you know, the front end of subversion and trac wiki page, but they are separated in it. This plugin defines a new wiki macro “IncludeSource”, then you can use a source file under subversion as wiki source for trac wiki.

The wiki page includes this plugin code, the wiki source is dynamically loaded from svn. Once you changed the wikisource.txt and commit it, the wiki page in trac is also changed dynamically.

Instruction

  1. This plugin require trac 0.10.x.
  2. If you use trac 0.9.x, please update it. And I’m sorry, currently this code doesn’t support trac 0.11.x because the plugin and wikimacro structure will be changed.

  3. Download follow Plugin file and put it into plugin path:

    /path/to/trac/root/plugins

  4. Restart trac server(or apache web server if you use mod_python)

  5. Create a new wiki page or edit current wiki page
  6. Place the “InsertSource” wikimacro:

    [[IncludeSource(/path/to/wiki-source-file/under/subversion)]]

  7. Save or preview

Download

IncludeSource.py

Share

Comments

  • Madwax said at 04/20, 2007
    You have a typo in the text above. The example should be:

    [[IncludeSource(/path/to/wiki-source-file/under/subversion)]]
  • Yoshimasa Niwa said at 04/28, 2007
    Thank you for pointing my miss type. I fixed it up.
  • SW said at 05/10, 2007


    I'm not sure what this plugin does.



    Does it insert the file in the current page, or does it take the file as the entire content of the current page.





    An example would be good to see.
  • Yoshimasa Niwa said at 05/15, 2007
    Hi, SW
    This plugin insert the file as wiki source in the page on which '[[IncludeSource()]]' macro placed.
    It Just dynamically replace the macro code to the content of file placed in SVN repo.
  • ckemmler@gmail.com said at 07/12, 2007
    Hi,

    Your macro is almost what I need. The only missing feature is the ability to specify start-line and end-line parameters.

    Is it hard to do?

    Actually I plan to use it to testbed a simple documentation mechanism for my project.

    Looking forward to read from you,

    Regards,

    Candide
  • Candide/ckemmler@gmail.com said at 07/13, 2007
    I just posted a blog about what I intend to do. I would love to have your comments about it.
  • piwik said at 01/14, 2008
    great !!! I needed it for the piwik trac :) thanks
    http://dev.piwik.org/trac/wiki/API

    when adding in your file the processors calls such as
    {{{
    #!php
    for example you can even include file contents with sytax coloring :-)
  • Chris Heller said at 03/10, 2008
    Hi Yoshimasa, I just posted an updated version of this with a few new features (like the start/end numbering) on the Trac MacroBazaar site.

    http://trac.edgewall.org/wiki/MacroBazaar#IncludeSource
  • Yoshimasa Niwa said at 03/13, 2008
    Hello, Chris. I checked your work for this tiny macro and it seems enough cool for us to use as an alternative of this macro :-)
  • Alexander said at 04/04, 2008
    please see my ticket about [[includetag('trunk/foo.cpp', 'tag1')]]

    http://trac-hacks.org/ticket/2861
  • Robert Reinhardt said at 04/16, 2009
    piwik mentioned that this plugin could be used in tandem with processor calls to format code, but I can't get the formatting processor to work. Can someone post a sample of using a formatter with the includesource plugin?
Your name
Your email
(optional)
Your url
(optional)
Your comment