From cdcd5eb6510fa482d238c3367d5ce909aebf5a19 Mon Sep 17 00:00:00 2001 From: Jussi Maatta Date: Sat, 25 Jan 2014 23:57:02 +0200 Subject: [PATCH] Fix double newlines in items imported from SuperMemo. When importing SuperMemo XML files, indicate to the BeautifulSoup XML parser that the
tag is self-closing. This prevents it from adding a matching
for every
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. --- anki/importing/supermemo_xml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anki/importing/supermemo_xml.py b/anki/importing/supermemo_xml.py index 94d30b80d..9a00438ce 100644 --- a/anki/importing/supermemo_xml.py +++ b/anki/importing/supermemo_xml.py @@ -140,7 +140,7 @@ class SupermemoXmlImporter(NoteImporter): #s = re.sub(u'>',u'>',s) #s = re.sub(u'<',u'<',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