mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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
This commit is contained in:
commit
68703e87f7
1
CHANGES
1
CHANGES
@ -39,6 +39,7 @@ Bugs fixed
|
||||
* #9883: autodoc: doccomment for the alias to mocked object was ignored
|
||||
* #9908: autodoc: debug message is shown on building document using NewTypes
|
||||
with Python 3.10
|
||||
* #9947: i18n: topic directive having a bullet list can't be translatable
|
||||
* #9878: mathjax: MathJax configuration is placed after loading MathJax itself
|
||||
* #9857: Generated RFC links use outdated base url
|
||||
* #9909: HTML, prevent line-wrapping in literal text.
|
||||
|
@ -208,7 +208,7 @@ class ApplySourceWorkaround(SphinxTransform):
|
||||
|
||||
def apply(self, **kwargs: Any) -> None:
|
||||
for node in self.document.traverse(): # type: Node
|
||||
if isinstance(node, (nodes.TextElement, nodes.image)):
|
||||
if isinstance(node, (nodes.TextElement, nodes.image, nodes.topic)):
|
||||
apply_source_workaround(node)
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user