>', html)
h2t = HTML2Text()
h2t.default_image_alt = _('Unnamed image')
+ h2t.body_width = 0
+ h2t.single_line_break = True
+ h2t.emphasis_mark = '*'
return h2t.handle(html)
@@ -27,12 +30,13 @@ def find_tests():
def test_html2text_behavior(self):
for src, expected in {
- 'test': 'test\n\n',
- 'test': '_test_\n\n',
- 'other': '[other](http://else.where/other)\n\n',
- '
': '\n\n',
- 'test dest': 'test dest\n\n',
- '<>a': '<>a\n\n',
+ 'test': 'test\n',
+ 'test': '*test*\n',
+ 'other': '[other](http://else.where/other)\n',
+ '
': '\n',
+ 'test dest': 'test dest\n',
+ '<>a': '<>a\n',
+ 'a
b': 'a\nb\n',
}.items():
self.assertEqual(html2text(src), expected)