Skip to content

Commit

Permalink
Merge pull request #296 from eric-wieser/fix-sphinx-1.5.1
Browse files Browse the repository at this point in the history
Fix missing classnames with sphinx 1.5.1
  • Loading branch information
vitaut committed Jan 2, 2017
2 parents c3c0abe + c683075 commit ad2d36f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ def visit_desc_signature(self, node):
# https://github.com/michaeljones/breathe/issues/242
self.declarator = node

def visit_desc_signature_line(self, node):
# In sphinx 1.5, there is now a desc_signature_line node within the desc_signature
# This should be used instead
self.declarator = node

def visit_desc_content(self, node):
self.content = node

Expand Down Expand Up @@ -257,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 @@ -305,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 ad2d36f

Please sign in to comment.