'Replace {{}} expressions with local URLs, with the ability to
override controller, function and URL query variables.Called
from re.sub.
@param match: the re match object'

def link(self, match):

    tokens = match.group(1).split(',')
    args = True
    parameters = {}
    arguments = []
    collect_args = False
    for token in tokens:
        if (not token):
            continue
        elif (':' in token):
            collect_args = False
            (key, value) = token.split(':')
        else:
            (key, value) = (token, None)
        key = key.strip()
        if (not value):
            if (key == 'noargs'):
                args = False
            elif collect_args:
                arguments.append(key)
        elif (key == 'args'):
            arguments.append(value.strip())
            collect_args = True
        else:
            parameters[key] = value.strip()
    request = current.request
    c = parameters.pop('c', request.controller)
    f = parameters.pop('f', request.function)
    if (not arguments):
        arguments = request.args
    args = (arguments if args else [])
    return URL(c=c, f=f, args=args, vars=parameters, host=True)
