# Support decoded entities with unifiable.
if not hasattr(__builtins__, 'True'): True, False = 1, 0
-import re, sys, urllib, htmlentitydefs, codecs, StringIO, types
+import re, sys, urllib, htmlentitydefs, codecs
import sgmllib
import urlparse
sgmllib.charref = re.compile('&#([xX]?[0-9a-fA-F]+)[^0-9a-fA-F]')
encoding = 'utf8'
if len(sys.argv) > 2:
encoding = sys.argv[2]
- f = open(arg, 'r')
- try:
- data = f.read().decode(encoding)
- finally:
- f.close()
+ f = open(arg, 'r')
+ try:
+ data = f.read().decode(encoding)
+ finally:
+ f.close()
else:
data = sys.stdin.read().decode('utf8')
wrapwrite(html2text(data, baseurl))
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: