Fix #5017: old displaymath node makes writers crashed

This commit is contained in:
Takeshi KOMIYA 2018-05-31 13:38:23 +09:00
parent 98f10216c7
commit 56b9eaebce

View File

@ -71,8 +71,12 @@ class MathNodeMigrator(SphinxTransform):
warnings.warn("math node for Sphinx was replaced by docutils'. "
"Please use ``docutils.nodes.math_block`` instead.",
RemovedInSphinx30Warning)
latex = node['latex']
node += nodes.Text(latex, latex)
if isinstance(node, displaymath):
newnode = nodes.math_block('', node['latex'], **node.attributes)
node.replace_self(newnode)
else:
latex = node['latex']
node += nodes.Text(latex, latex)
def setup(app):