5868c1f8d1
3.02: * Use optparse for parsing and checking arguments * Encode all output as UTF-8 * Accept optional encoding for local file or URL * Use chardet for guessing local file character sets * Fix double-newlines inside code blocks 3.01: * Fix bug with unknown entities 3.0: * Add forward compatibility with Python3 2.40: * Update from sgmllib to HTMLParser so that valid XHTML doesn't fail
23 lines
830 B
Text
23 lines
830 B
Text
$NetBSD: patch-aa,v 1.7 2011/06/09 06:21:38 schmonz Exp $
|
|
|
|
Small cleanup patch from Debian.
|
|
|
|
--- html2text.py.orig 2011-03-08 23:35:25.000000000 +0000
|
|
+++ html2text.py
|
|
@@ -305,6 +305,7 @@ class _html2text(HTMLParser.HTMLParser):
|
|
if has_key(attrs, 'src'):
|
|
attrs['href'] = attrs['src']
|
|
alt = attrs.get('alt', '')
|
|
+ alt = re.sub('\n', ' ', alt)
|
|
i = self.previousIndex(attrs)
|
|
if i is not None:
|
|
attrs = self.a[i]
|
|
@@ -325,7 +326,7 @@ class _html2text(HTMLParser.HTMLParser):
|
|
if tag in ["ol", "ul"]:
|
|
if start:
|
|
self.list.append({'name':tag, 'num':0})
|
|
- else:
|
|
+ elif self.list:
|
|
if self.list: self.list.pop()
|
|
|
|
self.p()
|