def trac_changeset_role(name, rawtext, text, lineno, inliner, 
                        options={}, content=[]):
    app = inliner.document.settings.env.app
    try:
        base = app.config.trac_url
        if not base:
            raise AttributeError
    except __HOLE__ as err:
        msg = 'trac_url configuration value is not set (%s)'
        raise ValueError(msg % str(err))    

    slash = '/' if base[-1] != '/' else ''
    unescaped = utils.unescape(text)
    prefix = 'changeset '
    node = nodes.literal(prefix, prefix)

    # Hard-coded for NetworkX
    if unescaped.endswith('networkx-svn-archive'):
        # Use the integer
        display = unescaped.split('/')[0]
    else:
        # hg: use the first 12 hash characters
        display = unescaped[:12]
        
    uri = base + slash + 'changeset/' + text
    node += nodes.reference(rawtext, display, refuri=uri, **options)
    return [node], []
dataset/ETHPy150Open networkx/networkx/doc/sphinxext/customroles.py/trac_changeset_role