From 385c031fd3e0796988b35b1b09c9977f7b0ba04a Mon Sep 17 00:00:00 2001 From: Brett Parker Date: Mon, 3 Mar 2008 13:28:26 +0000 Subject: [PATCH 1/1] Fix blockquote support --- rss2maildir.py | 4 ++-- tests/expected/blockquote.txt | 6 ++++++ tests/html/blockquote.html | 5 +++++ tests/unittests/BlockquoteTests.py | 19 +++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 tests/expected/blockquote.txt create mode 100644 tests/html/blockquote.html create mode 100755 tests/unittests/BlockquoteTests.py 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() -- 2.39.5