Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-12-09 19:33:09 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-12-09 19:33:09 +0300
commitf2f91ffb84163705341832f07a13e25b3b3d953a (patch)
treebfe37d4ce0445ee1f1969ac3f8cd6cd879e5eef7 /sphinx/util
parent58513449341e540a722645878678d89fc9c21b0d (diff)
Fix #9947: i18n: topic directive having a bullet list can't be translatable
It seems docutils does not fill the topic node with the source info when a topic directive has a bullet list. As a workaround, This fills the source info of them.
Diffstat (limited to 'sphinx/util')
-rw-r--r--sphinx/util/nodes.py5
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: