A bug macro to improve integration with your bug tracking system. The attached code is configured for debian wiki. You can easily change the configuration for you own system.

Instead of repeating [http://example.com/bugtracker.cgi?id=123 #123], write [[Bug(123)]].

Tested with 1.3.5.

   1 """ Debian bug macro
   2 
   3 Usage::
   4 
   5     [[Bug(number)]]
   6 
   7 @copyright: 2007 by Nir Soffer <nirs@freeshell.org>
   8 @license: GNU GPL
   9 """
  10 from MoinMoin.wikiutil import escape
  11 
  12 Dependencies = [] # static
  13 
  14 def execute(macro, args):
  15     if args is None or args.strip() == '':
  16         bug = '?' # hint for editor
  17     else:
  18         bug = args.split(',', 1)[0].strip()
  19 
  20     url = 'http://bugs.debian.org/' + bug
  21     # formatter.url does not escape the title
  22     title = "Debian bug #" + escape(bug, 1) 
  23     formatter = macro.formatter
  24     
  25     return ''.join([formatter.url(1, url, type='www', title=title),
  26                     formatter.text('#' + bug),
  27                     formatter.url(0)])
Bug.py

Discussion

A simpler and easier to use the InterWiki system:

Add your bug tracker to intermap.txt:

Bug http://example.com/bugs/

Then link to bugs like this:

I'm working on Bug:12345

I'm working on 12345

You may still want to use this macro for its additional title attribute and link text though.

MoinMoin: MacroMarket/Bug (last edited 2007-10-29 19:16:45 by localhost)