strip html from latex so clozes work properly

in the future we could look at replacing the cloze html with something
prettier, but it might cause latex errors
This commit is contained in:
Damien Elmes 2011-04-17 06:59:46 +09:00
parent f0909ebed2
commit 4a568a83be

View file

@ -3,7 +3,7 @@
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import re, os, sys, shutil, cgi, subprocess
from anki.utils import checksum, call, namedtmp, tmpdir, isMac
from anki.utils import checksum, call, namedtmp, tmpdir, isMac, stripHTML
from anki.hooks import addHook
from htmlentitydefs import entitydefs
from anki.lang import _
@ -65,6 +65,7 @@ def _latexFromHtml(deck, latex):
if match.group(1) in entitydefs:
latex = latex.replace(match.group(), entitydefs[match.group(1)])
latex = re.sub("<br( /)?>", "\n", latex)
latex = stripHTML(latex)
latex = latex.encode("utf-8")
return latex