def visit_target(self, node):
        """
        When we find a target node, first make sure it matches the last
        reference node we saw. Assuming it does, see if its refuri (link URI)
        is in our replacement list. If so, replace the link with an internal
        reference.
        """
        if self.lastref is None:
            return
        if (
            self.lastref.attributes['name'].lower() not in
            node.attributes['names'] and
            self.lastref.attributes['name'].lower() not in
            node.attributes['dupnames']
        ):
            # return if target doesn't match last reference found
            return
        if node.attributes['refuri'] not in self.replacements:
            # return if the refuri isn't in our replacement mapping
            return
        # ok, we have a node to replace...
        params = self.replacements[node.attributes['refuri']]
        meth = params[0]
        args = params[1:]
        # remove the target itself; we'll just replace the reference
        node.parent.remove(node)
        self.lastref.parent.replace(self.lastref, meth(*args))
def visit_target ( self , node ) : if self . lastref is None : return if ( self . lastref . attributes [ 'name' ] . lower ( ) not in node . attributes [ 'names' ] and self . lastref . attributes [ 'name' ] . lower ( ) not in node . attributes [ 'dupnames' ] ) : return if node . attributes [ 'refuri' ] not in self . replacements : return params = self . replacements [ node . attributes [ 'refuri' ] ] meth = params [ 0 ] args = params [ 1 : ] node . parent . remove ( node ) self . lastref . parent . replace ( self . lastref , meth ( * args ) )
When we find a target node, first make sure it matches the last
        reference node we saw. Assuming it does, see if its refuri (link URI)
        is in our replacement list. If so, replace the link with an internal
        reference.