Renamed _decode_htmlescapes s variable

This commit is contained in:
evandrocoan 2020-03-10 13:55:27 -03:00
parent 131d37dca5
commit c7bf6f3a8d

View file

@ -143,18 +143,18 @@ class SupermemoXmlImporter(NoteImporter):
] ]
) )
def _decode_htmlescapes(self, s: str) -> str: def _decode_htmlescapes(self, html: str) -> str:
"""Unescape HTML code.""" """Unescape HTML code."""
# In case of bad formated html you can import MinimalSoup etc.. see btflsoup source code # In case of bad formated html you can import MinimalSoup etc.. see BeautifulSoup source code
from bs4 import BeautifulSoup as btflsoup from bs4 import BeautifulSoup
# my sm2004 also ecaped & char in escaped sequences. # my sm2004 also ecaped & char in escaped sequences.
s = re.sub("&", "&", s) html = re.sub("&", "&", html)
# unescaped solitary chars < or > that were ok for minidom confuse btfl soup # unescaped solitary chars < or > that were ok for minidom confuse btfl soup
# s = re.sub(u'>',u'&gt;',s) # html = re.sub(u'>',u'&gt;',html)
# s = re.sub(u'<',u'&lt;',s) # html = re.sub(u'<',u'&lt;',html)
return str(btflsoup(s, "html.parser")) return str(BeautifulSoup(html, "html.parser"))
def _afactor2efactor(self, af: float) -> float: def _afactor2efactor(self, af: float) -> float:
# Adapted from <http://www.supermemo.com/beta/xml/xml-core.htm> # Adapted from <http://www.supermemo.com/beta/xml/xml-core.htm>