Skip to content

Commit

Permalink
Use the node finder everywhere, so that #292-related bugs are avoided
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-wieser committed Jan 2, 2017
1 parent 601b2ee commit 0f86aab
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions breathe/renderer/sphinxrenderer.py
Expand Up @@ -262,7 +262,12 @@ def run_domain_directive(self, kind, names):
nodes = domain_directive.run()

# Filter out outer class names if we are rendering a member as a part of a class content.
signode = nodes[1].children[0]
rst_node = nodes[1]
finder = NodeFinder(rst_node.document)
rst_node.walk(finder)

signode = finder.declarator

if len(names) > 0 and self.context.child:
signode.children = [n for n in signode.children if not n.tagname == 'desc_addname']
return nodes
Expand Down Expand Up @@ -310,9 +315,14 @@ def render_declaration(self, node, declaration=None, description=None, **kwargs)
if obj_type is None:
obj_type = node.kind
nodes = self.run_domain_directive(obj_type, [declaration.replace('\n', ' ')])

rst_node = nodes[1]
signode = rst_node[0]
contentnode = rst_node[-1]
finder = NodeFinder(rst_node.document)
rst_node.walk(finder)

signode = finder.declarator
contentnode = finder.content

update_signature = kwargs.get('update_signature', None)
if update_signature is not None:
update_signature(signode, obj_type)
Expand Down

0 comments on commit 0f86aab

Please sign in to comment.