diff --git a/html2text.py b/html2text.py index 17528901..fcde94ac 100755 --- a/html2text.py +++ b/html2text.py @@ -7,7 +7,7 @@ # TODO: # Support decoded entities with unifiable. - +# Exception handle try: True except NameError: @@ -18,6 +18,7 @@ def has_key(x, y): if hasattr(x, 'has_key'): return x.has_key(y) else: return y in x +# Exception Handle for Library try: import htmlentitydefs import urlparse @@ -72,6 +73,7 @@ def name2cp(k): if k.startswith("&#") and k.endswith(";"): return int(k[2:-1]) # not in latin-1 return ord(codecs.latin_1_decode(k)[0]) +# Defining Dictionary unifiable = {'rsquo':"'", 'lsquo':"'", 'rdquo':'"', 'ldquo':'"', 'copy':'(C)', 'mdash':'--', 'nbsp':' ', 'rarr':'->', 'larr':'<-', 'middot':'*', 'ndash':'-', 'oelig':'oe', 'aelig':'ae',