diff options
author | Wade Brainerd <wadetb@gmail.com> | 2008-05-27 19:43:36 (GMT) |
---|---|---|
committer | Wade Brainerd <wadetb@gmail.com> | 2008-05-27 19:43:36 (GMT) |
commit | e5e84e643838000895e86285bb867763d54c21c7 (patch) | |
tree | 5b24c41ddc8dfe9dc00357dd33190cbe2f9c81b5 /server.py | |
parent | 220305a6d05647be7fb3e8d6324844c7e6438e4e (diff) |
Add try/except to Blahtex XML parsing.
Diffstat (limited to 'server.py')
-rwxr-xr-x | server.py | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -158,13 +158,17 @@ class WPMathRenderer: return "" # Ugly! There is certainly a better way to do this, but my DOM skills are weak, and this works. - dom = xml.dom.minidom.parseString(mathml) - dom = dom.getElementsByTagName('blahtex')[0] - dom = dom.getElementsByTagName('mathml')[0] - dom = dom.getElementsByTagName('markup')[0] - mathml = dom.toxml() - mathml = mathml.replace('markup', 'math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"') - dom.unlink() + try: + dom = xml.dom.minidom.parseString(mathml) + dom = dom.getElementsByTagName('blahtex')[0] + dom = dom.getElementsByTagName('mathml')[0] + dom = dom.getElementsByTagName('markup')[0] + mathml = dom.toxml() + mathml = mathml.replace('markup', 'math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"') + dom.unlink() + except: + print "BLAHTEX XML PARSING FAILED: '%s'" % mathml + return "" # Straight embedding. Requires parent document to be XHTML. return mathml |