Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def onLatexAdd(self, evt):
import latex2mathml.converter
from dialogs import LatexEntryDialog
entryDialog = LatexEntryDialog(gui.mainFrame)
if entryDialog.ShowModal() == wx.ID_OK:
latex = entryDialog.GetValue()
mathml = latex2mathml.converter.convert(latex)
if sys.version_info.major == 2:
import HTMLParser
mathml = HTMLParser.HTMLParser().unescape(mathml)
elif sys.version_info.major >= 3:
import html
mathml = html.unescape(mathml)
MathMlReaderInteraction(mathMl=mathml, interaction_frame=True)