Fix double newlines in items imported from SuperMemo.

When importing SuperMemo XML files, indicate to the BeautifulSoup
XML parser that the <br> tag is self-closing. This prevents it
from adding a matching </br> for every <br> tag. These extraneous
tags resulted in extra newlines in items imported from SuperMemo.

While we're at it, fix the same bug for a couple of other
self-closing HTML tags.
This commit is contained in:
Jussi Maatta 2014-01-25 23:57:02 +02:00
parent 6c6be1144b
commit cdcd5eb651

View file

@ -140,7 +140,7 @@ class SupermemoXmlImporter(NoteImporter):
#s = re.sub(u'>',u'&gt;',s) #s = re.sub(u'>',u'&gt;',s)
#s = re.sub(u'<',u'&lt;',s) #s = re.sub(u'<',u'&lt;',s)
return unicode(btflsoup(s,convertEntities=btflsoup.HTML_ENTITIES )) return unicode(btflsoup(s, selfClosingTags=['br','hr','img','wbr'], convertEntities=btflsoup.HTML_ENTITIES))
## DEFAULT IMPORTER METHODS ## DEFAULT IMPORTER METHODS