Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing classnames with sphinx 1.5.1 #296

Merged
merged 2 commits into from
Jan 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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