From 9a4c55083ef741cd562529f93b331f4c583e61b7 Mon Sep 17 00:00:00 2001 From: Brett Parker Date: Sat, 5 Jan 2008 10:06:32 +0000 Subject: [PATCH 1/1] 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) --- rss2maildir.py | 4 +++- tests/expected/unorderedlist-wellformed.txt | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) 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 -- 2.39.5