Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2007-03-10 15:46:29
Size: 1238
Editor: ?NirSoffer
Comment: Suggestions for this wiki
Revision 3 as of 2009-03-16 03:31:53
Size: 855
Editor: anonymous
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Bug macro = = Bug Interwiki =
Line 5: Line 5:
A better solution is to add a Bug macro to this wiki:

{{{#!python
""" Debian bug macro

Usage::

    [[Bug(number)]]

@copyright: 2007 by Nir Soffer <nirs AT freeshell DOT org>
@license: GNU GPL
"""
from MoinMoin.wikiutil import escape

Dependencies = [] # static

def execute(macro, args):
    if args is None or args.strip() == '':
        bug = '?' # hint for editor
    else:
        bug = args.split(',', 1)[0].strip()

    url = 'http://bugs.debian.org/' + bug
    # formatter.url does not escape the title
    title = "Debian bug #" + escape(bug, 1)
    formatter = macro.formatter
    
    return ''.join([formatter.url(1, url, type='www', title=title),
                    formatter.text('#' + bug),
                    formatter.url(0)])
A better solution is to add this interwiki to the wiki intermap.txt:
{{{
Bug http://bugs.debian.org/
Line 37: Line 10:
Installation:
 1. Save this code in `path/to/wiki/data/plugin/macro/Bug.py`
 2. If you use mod python, fast cgi or standalone server, restart the wiki
Then you can link to bug using this syntax:
{{{
I'm working on Bug:402289
}}}
## MoinMoin is used because Bug is unknown here...
I'm working on MoinMoin:402289

= Bug macro =

There is a Bug macro in MoinMoin:MacroMarket/Bug.

Using the bug macro is little more involved, but it render nicer links with better title and link text:
{{{
I'm working on [[Bug(402289)]]
}}}
I'm working on [[http://bugs.debian.org/402289|#402289]]

Bug Interwiki

I see that users refer to bugs using [http://bugs.debian.org/402289 #402289]. These links are easy to mistype, and will break if the bug system url will change. Also, if you want one day to replace all bug from "#n" to "bug N", you have to search and replace the whole wiki.

A better solution is to add this interwiki to the wiki intermap.txt:

Bug http://bugs.debian.org/

Then you can link to bug using this syntax:

I'm working on Bug:402289

I'm working on 402289

Bug macro

There is a Bug macro in MacroMarket/Bug.

Using the bug macro is little more involved, but it render nicer links with better title and link text:

I'm working on [[Bug(402289)]]

I'm working on #402289