From c45f962b05106d91d64d9fa820a3951b694d9a6a Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 29 Jul 2019 01:35:50 +0900 Subject: [PATCH] Fix #6620: i18n: classifiers of definition list are not translated with docutils-0.15 --- CHANGES | 2 ++ sphinx/util/nodes.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 4595a44b5e9..adeb8ad04ef 100644 --- a/CHANGES +++ b/CHANGES @@ -58,6 +58,8 @@ Bugs fixed * #6549: sphinx-build: Escaped characters in error messages * #6545: doctest comments not getting trimmed since Sphinx 1.8.0 * #6561: glossary: Wrong hyperlinks are generated for non alphanumeric terms +* #6620: i18n: classifiers of definition list are not translated with + docutils-0.15 Testing -------- diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index abbc432df10..52e43c2e210 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -133,6 +133,9 @@ def apply_source_workaround(node: Element) -> None: node.source = definition_list_item.source node.line = definition_list_item.line - 1 node.rawsource = node.astext() # set 'classifier1' (or 'classifier2') + elif isinstance(node, nodes.classifier) and not node.source: + # docutils-0.15 fills in rawsource attribute, but not in source. + node.source = node.parent.source if isinstance(node, nodes.image) and node.source is None: logger.debug('[i18n] PATCH: %r to have source, line: %s', get_full_module_name(node), repr_domxml(node))