Fix possible 'no-wrap' KeyError in maths nodes (#13323)

This commit is contained in:
Adam Turner 2025-02-09 22:30:12 +00:00 committed by GitHub
parent 790bee64ce
commit b59d1b7513
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -365,7 +365,7 @@ def html_visit_math(self: HTML5Translator, node: nodes.math) -> None:
def html_visit_displaymath(self: HTML5Translator, node: nodes.math_block) -> None:
if node['no-wrap'] or node['nowrap']:
if node.get('no-wrap', node.get('nowrap', False)):
latex = node.astext()
else:
latex = wrap_displaymath(node.astext(), None, False)

View File

@ -47,7 +47,7 @@ def html_visit_math(self: HTML5Translator, node: nodes.math) -> None:
def html_visit_displaymath(self: HTML5Translator, node: nodes.math_block) -> None:
self.body.append(self.starttag(node, 'div', CLASS='math notranslate nohighlight'))
if node['no-wrap']:
if node.get('no-wrap', node.get('nowrap', False)):
self.body.append(self.encode(node.astext()))
self.body.append('</div>')
raise nodes.SkipNode

View File

@ -2465,7 +2465,7 @@ class LaTeXTranslator(SphinxTranslator):
else:
label = None
if node.get('no-wrap'):
if node.get('no-wrap', node.get('nowrap', False)):
if label:
self.body.append(r'\label{%s}' % label)
self.body.append(node.astext())