From: Brett Parker Date: Mon, 3 Mar 2008 13:28:26 +0000 (+0000) Subject: Fix blockquote support X-Git-Url: https://git.sommitrealweird.co.uk/rss2maildir.git/commitdiff_plain/385c031fd3e0796988b35b1b09c9977f7b0ba04a?ds=sidebyside;hp=17148f77fac59add006e131c439b41da9d8d2b43 Fix blockquote support --- diff --git a/rss2maildir.py b/rss2maildir.py index 86387f9..dd5b112 100755 --- a/rss2maildir.py +++ b/rss2maildir.py @@ -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 index 0000000..e37148e --- /dev/null +++ b/tests/expected/blockquote.txt @@ -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 index 0000000..46320e0 --- /dev/null +++ b/tests/html/blockquote.html @@ -0,0 +1,5 @@ +

A block quote test

+

Earlier someone said:

+
+The world isn't flat after all, it's actually round, so there. +
diff --git a/tests/unittests/BlockquoteTests.py b/tests/unittests/BlockquoteTests.py new file mode 100755 index 0000000..7206e6c --- /dev/null +++ b/tests/unittests/BlockquoteTests.py @@ -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()