Skip to content

Commit

Permalink
Fix sphinx-doc#9322: KeyError is raised on PropagateDescDomain transform
Browse files Browse the repository at this point in the history
PropageteDescDomain applies the domain name from the "domain" attribute
of parent node (desc node) to the desc_signature node.  The structure
has longly generated by ObjectDescription.  But it must not be a new
rule.

This allows to build document that contains non standard doctree.
  • Loading branch information
tk0miya committed Jun 13, 2021
1 parent e7e92d3 commit 2de7c35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -17,6 +17,7 @@ Bugs fixed
----------

* #9313: LaTeX: complex table with merged cells broken since 4.0
* #9322: KeyError is raised on PropagateDescDomain transform

Testing
--------
Expand Down
3 changes: 2 additions & 1 deletion sphinx/transforms/post_transforms/__init__.py
Expand Up @@ -249,7 +249,8 @@ class PropagateDescDomain(SphinxPostTransform):

def run(self, **kwargs: Any) -> None:
for node in self.document.traverse(addnodes.desc_signature):
node['classes'].append(node.parent['domain'])
if node.parent.get('domain'):
node['classes'].append(node.parent['domain'])


def setup(app: Sphinx) -> Dict[str, Any]:
Expand Down

0 comments on commit 2de7c35

Please sign in to comment.