Fix blockquote support
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Mon, 3 Mar 2008 13:28:26 +0000 (13:28 +0000)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Mon, 3 Mar 2008 13:28:26 +0000 (13:28 +0000)
rss2maildir.py
tests/expected/blockquote.txt [new file with mode: 0644]
tests/html/blockquote.html [new file with mode: 0644]
tests/unittests/BlockquoteTests.py [new file with mode: 0755]

index 86387f96ac01c2d8c1dfa12e9e6f4efddef92d27..dd5b112e5ac12a889f08926cbb2a05148e9b0a0c 100755 (executable)
@@ -188,7 +188,7 @@ class HTML2Text(HTMLParser):
         u'dt',
         u'dd',
         u'div',
-        #u'blockquote',
+        u'blockquote',
         ]
 
     liststarttags = [
@@ -411,7 +411,7 @@ class HTML2Text(HTMLParser):
             if len(self.text) > 0 and self.text[-1] != u'\n':
                 self.text = self.text + u'\n'
             self.text = self.text \
-                + u'> ' \
+                + u'    ' \
                 + seperator.join( \
                     textwrap.wrap( \
                         quote, \
diff --git a/tests/expected/blockquote.txt b/tests/expected/blockquote.txt
new file mode 100644 (file)
index 0000000..e37148e
--- /dev/null
@@ -0,0 +1,6 @@
+A block quote test
+==================
+
+Earlier someone said:
+
+    The world isn't flat after all, it's actually round, so there.
diff --git a/tests/html/blockquote.html b/tests/html/blockquote.html
new file mode 100644 (file)
index 0000000..46320e0
--- /dev/null
@@ -0,0 +1,5 @@
+<h1>A block quote test</h1>
+<p>Earlier someone said:</p>
+<blockquote>
+The world isn't flat after all, it's actually round, so there.
+</blockquote>
diff --git a/tests/unittests/BlockquoteTests.py b/tests/unittests/BlockquoteTests.py
new file mode 100755 (executable)
index 0000000..7206e6c
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+
+import unittest
+import sys
+import os
+
+import ParsingTests
+
+class BlockquoteTests(ParsingTests.ParsingTest):
+    def testWellFormedBlockquote(self):
+       return self.runParsingTest("blockquote") 
+
+def suite():
+    suite = unittest.TestSuite()
+    suite.addTest(BlockquoteTests("testWellFormedBlockquote"))
+    return suite
+
+if __name__ == "__main__":
+    unittest.main()