From c394886af80e8fa6760250d6342b8e6f91f5e42f Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 15 Jun 2012 01:09:16 +0900 Subject: [PATCH] fix nbsp handling in latex --- anki/latex.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/anki/latex.py b/anki/latex.py index fdb14e463..f46e0a654 100644 --- a/anki/latex.py +++ b/anki/latex.py @@ -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("", "\n", latex) # replace
etc with spaces