diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-12-11 05:00:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-11 05:00:21 +0300 |
commit | 68703e87f71d1f5a02c053a1da8c8106ed2ec2a5 (patch) | |
tree | 10e70cbd153bedafda7f9759491922a1d02f5701 /sphinx/util | |
parent | d3162d1ff2e24f4d190ed3ba5bc76d72c781f791 (diff) | |
parent | f2f91ffb84163705341832f07a13e25b3b3d953a (diff) |
Merge pull request #9953 from tk0miya/9947_source_info_less_topic_node
Fix #9947: i18n: topic directive having a bullet list can't be translatable
Diffstat (limited to 'sphinx/util')
-rw-r--r-- | sphinx/util/nodes.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index bc16e44c1..c0700f3bb 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -150,6 +150,11 @@ def apply_source_workaround(node: Element) -> None: for classifier in reversed(list(node.parent.traverse(nodes.classifier))): node.rawsource = re.sub(r'\s*:\s*%s' % re.escape(classifier.astext()), '', node.rawsource) + if isinstance(node, nodes.topic) and node.source is None: + # docutils-0.18 does not fill the source attribute of topic + logger.debug('[i18n] PATCH: %r to have source, line: %s', + get_full_module_name(node), repr_domxml(node)) + node.source, node.line = node.parent.source, node.parent.line # workaround: literal_block under bullet list (#4913) if isinstance(node, nodes.literal_block) and node.source is None: |