]> git.sommitrealweird.co.uk Git - rss2maildir.git/commitdiff
Update li handling a bit, and make the expected test results be what we'd
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Sat, 5 Jan 2008 10:06:32 +0000 (10:06 +0000)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Sat, 5 Jan 2008 10:06:32 +0000 (10:06 +0000)
actually want (previous version might have been a bit of a work around)

rss2maildir.py
tests/expected/unorderedlist-wellformed.txt

index 7acbe54966ae02ff2cfaaf7cd3d67bb49cb0eb09..3e4ed605d1eaa7669e1faccd25904449d2a6596b 100755 (executable)
@@ -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
index 6f37326a9661aa00b0a7fb6551a492691c99e6b3..02f68acc012d1f432de49b06c606a14ac507b80b 100644 (file)
@@ -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