From: Brett Parker Date: Sat, 5 Jan 2008 10:06:32 +0000 (+0000) Subject: Update li handling a bit, and make the expected test results be what we'd X-Git-Url: https://git.sommitrealweird.co.uk/rss2maildir.git/commitdiff_plain/9a4c55083ef741cd562529f93b331f4c583e61b7?ds=inline Update li handling a bit, and make the expected test results be what we'd actually want (previous version might have been a bit of a work around) --- diff --git a/rss2maildir.py b/rss2maildir.py index 7acbe54..3e4ed60 100755 --- a/rss2maildir.py +++ b/rss2maildir.py @@ -227,7 +227,9 @@ class HTML2Text(HTMLParser): elif self.inpre: self.text = self.text + unicode(data, "utf-8") else: - self.text = self.text + unicode(data, "utf-8").strip() + u' ' + isallwhitespace = data.strip() + if isallwhitespace != "" and self.text[-1] == "\n": + self.text = self.text + unicode(data, "utf-8").strip() + u' ' def handle_entityref(self, name): entity = name diff --git a/tests/expected/unorderedlist-wellformed.txt b/tests/expected/unorderedlist-wellformed.txt index 6f37326..02f68ac 100644 --- a/tests/expected/unorderedlist-wellformed.txt +++ b/tests/expected/unorderedlist-wellformed.txt @@ -1,5 +1,4 @@ -This is a well formed unordered list. - * The first item - * The second item - * The third item - +This is a well formed unordered list. + * The first item + * The second item + * The third item