mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
fix nbsp handling in latex
This commit is contained in:
parent
4c7f7a7c4b
commit
c394886af8
1 changed files with 3 additions and 2 deletions
|
@ -61,10 +61,11 @@ def _imgLink(col, latex, model):
|
|||
|
||||
def _latexFromHtml(col, latex):
|
||||
"Convert entities and fix newlines."
|
||||
# entitydefs defines nbsp as \xa0 instead of a standard space, so we
|
||||
# replace it first
|
||||
latex = latex.replace(" ", " ")
|
||||
for match in re.compile("&([a-z]+);", re.IGNORECASE).finditer(latex):
|
||||
if match.group(1) in entitydefs:
|
||||
if match.group() == " ":
|
||||
continue
|
||||
latex = latex.replace(match.group(), entitydefs[match.group(1)])
|
||||
latex = re.sub("<br( /)?>", "\n", latex)
|
||||
# replace <div> etc with spaces
|
||||
|
|
Loading…
Reference in a new issue