mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
replace nbsp with standard space when stripping html
fixes https://anki.tenderapp.com/discussions/ankidesktop/1952-duplicate-not-detected-on-paste
This commit is contained in:
parent
ffff271362
commit
2ba8c41fec
2 changed files with 3 additions and 3 deletions
|
@ -60,9 +60,6 @@ def _imgLink(col, latex, model):
|
||||||
|
|
||||||
def _latexFromHtml(col, latex):
|
def _latexFromHtml(col, latex):
|
||||||
"Convert entities and fix newlines."
|
"Convert entities and fix newlines."
|
||||||
# entitydefs defines nbsp as \xa0 instead of a standard space, so we
|
|
||||||
# replace it first
|
|
||||||
latex = latex.replace(" ", " ")
|
|
||||||
latex = re.sub("<br( /)?>|<div>", "\n", latex)
|
latex = re.sub("<br( /)?>|<div>", "\n", latex)
|
||||||
latex = re.sub("<.+?>", "", latex)
|
latex = re.sub("<.+?>", "", latex)
|
||||||
latex = stripHTML(latex)
|
latex = stripHTML(latex)
|
||||||
|
|
|
@ -146,6 +146,9 @@ def minimizeHTML(s):
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def entsToTxt(html):
|
def entsToTxt(html):
|
||||||
|
# entitydefs defines nbsp as \xa0 instead of a standard space, so we
|
||||||
|
# replace it first
|
||||||
|
html = html.replace(" ", " ")
|
||||||
def fixup(m):
|
def fixup(m):
|
||||||
text = m.group(0)
|
text = m.group(0)
|
||||||
if text[:2] == "&#":
|
if text[:2] == "&#":
|
||||||
|
|
Loading…
Reference in a new issue