'Main directive entry function, called by docutils upon encountering the
directive.
This directive is meant to be quite easily subclassable, so it delegates
to several additional methods.  What it does:
* find out if called as a domain-specific directive, set self.domain
* create a `desc` node to fit all description inside
* parse standard options, currently `noindex`
* create an index node if needed as self.indexnode
* parse all given signatures (as returned by self.get_signatures())
using self.handle_signature(), which should either return a name
or raise ValueError
* add index entries using self.add_target_and_index()
* parse the content and handle doc fields in it'

def run(self):

    if (':' in self.name):
        (self.domain, self.objtype) = self.name.split(':', 1)
    else:
        (self.domain, self.objtype) = ('', self.name)
    self.env = self.state.document.settings.env
    self.indexnode = addnodes.index(entries=[])
    node = addnodes.desc()
    node.document = self.state.document
    node['domain'] = self.domain
    node['objtype'] = node['desctype'] = self.objtype
    node['noindex'] = noindex = ('noindex' in self.options)
    self.names = []
    signatures = self.get_signatures()
    for (i, sig) in enumerate(signatures):
        signode = addnodes.desc_signature(sig, '')
        signode['first'] = False
        node.append(signode)
        try:
            name = self.handle_signature(sig, signode)
        except ValueError:
            signode.clear()
            signode += addnodes.desc_name(sig, sig)
            continue
        if (name not in self.names):
            self.names.append(name)
            if (not noindex):
                self.add_target_and_index(name, sig, signode)
    contentnode = addnodes.desc_content()
    node.append(contentnode)
    if self.names:
        self.env.temp_data['object'] = self.names[0]
    self.before_content()
    self.state.nested_parse(self.content, self.content_offset, contentnode)
    DocFieldTransformer(self).transform_all(contentnode)
    self.env.temp_data['object'] = None
    self.after_content()
    return [self.indexnode, node]
